uyuni icon indicating copy to clipboard operation
uyuni copied to clipboard

Add sleep time before rebooting transactional systems after bootstraping

Open wweellddeerr opened this issue 1 year ago • 7 comments

What does this PR change?

It introduces a delay before rebooting transactional systems post-bootstrap. This addresses cases where the system would reboot before Salt had a chance to send the results of applying the bootstrap state. Such occurrences resulted in error messages appearing in the WebUI, even though the bootstrap operation was actually successful.

GUI diff

No difference.

  • [x] DONE

Documentation

  • No documentation needed: only internal and user invisible changes

  • [x] DONE

Test coverage

  • No tests: sls files only

  • [x] DONE

Links

Issue(s): https://github.com/SUSE/spacewalk/issues/23248

  • [x] DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • [ ] No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • [ ] Re-run test "changelog_test"
  • [ ] Re-run test "backend_unittests_pgsql"
  • [ ] Re-run test "java_pgsql_tests"
  • [ ] Re-run test "schema_migration_test_pgsql"
  • [ ] Re-run test "susemanager_unittests"
  • [ ] Re-run test "javascript_lint"
  • [ ] Re-run test "spacecmd_unittests"

Before you merge

Check How to branch and merge properly!

wweellddeerr avatar Jan 11 '24 19:01 wweellddeerr

I can't say I like this. Can we assume ownership of managed system and just reboot it directly instead of relying on rebootmgr? If so, then we can just initiate delayed reboot like this for example:

reboot_transactional_server:
  cmd.run_bg:
    - name: sleep 10; reboot
    - require:
      - {{ salt_minion_name }}

aaannz avatar Jan 12 '24 10:01 aaannz

but do we safely know how much time to put on sleep?

rjmateus avatar Jan 12 '24 11:01 rjmateus

We do not. It's an educated guess that this should be the last state to be executed during bootstrap. We have these guesses in multiple places:

  • saltboot minion stop https://github.com/uyuni-project/retail/blob/master/saltboot-formula/_states/saltboot.py#L1933
  • minion cleanup routine https://github.com/uyuni-project/uyuni/blob/master/susemanager-utils/susemanager-sls/salt/cleanup_minion/init.sls#L67
  • bootstrap proxy path update https://github.com/uyuni-project/uyuni/blob/master/susemanager-utils/susemanager-sls/salt/bootstrap/set_proxy.sls#L23

aaannz avatar Jan 12 '24 11:01 aaannz

good point and I think is fair enough. upvote from my side

rjmateus avatar Jan 12 '24 11:01 rjmateus

I can't say I like this. Can we assume ownership of managed system and just reboot it directly instead of relying on rebootmgr? If so, then we can just initiate delayed reboot like this for example:

reboot_transactional_server:
  cmd.run_bg:
    - name: sleep 10; reboot
    - require:
      - {{ salt_minion_name }}

Thanks @aaannz I'll experiment this suggestion, I agree it's a better solution to the problem.

wweellddeerr avatar Jan 12 '24 11:01 wweellddeerr

Applying the suggested changes worked like a charm. @aaannz does it look better for you now?

wweellddeerr avatar Jan 16 '24 00:01 wweellddeerr

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Apr 28 '24 01:04 github-actions[bot]

This PR was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar May 09 '24 01:05 github-actions[bot]