Skip to content

many: restart snapd from daemon.Stop#16676

Draft
alfonsosanchezbeato wants to merge 2 commits intocanonical:masterfrom
alfonsosanchezbeato:move-snapd-restart-to-stop
Draft

many: restart snapd from daemon.Stop#16676
alfonsosanchezbeato wants to merge 2 commits intocanonical:masterfrom
alfonsosanchezbeato:move-snapd-restart-to-stop

Conversation

@alfonsosanchezbeato
Copy link
Member

Move snapd service restart logic from AddSnapdSnapServices to daemon.Stop,
calling it only when a daemon restart is explicitly requested. This ensures
that most system resources are freed before another snapd instance starts, as
we could have two for a short period of time.

Move snapd service restart logic from AddSnapdSnapServices to daemon.Stop,
calling it only when a daemon restart is explicitly requested. This ensures
that most system resources are freed before another snapd instance starts, as
we could have two for a short period of time.

- Add Restart() function to wrappers package for restarting snapd
- services Call wrappers.Restart() in daemon.Stop when restart is
- requested Update tests to verify systemctl calls during daemon
- restart Remove automatic service restart from AddSnapdSnapServices
@github-actions github-actions bot added Needs Documentation -auto- Label automatically added which indicates the change needs documentation Run only one system Only runs spread tests on one system labels Feb 25, 2026
@alfonsosanchezbeato alfonsosanchezbeato removed Needs Documentation -auto- Label automatically added which indicates the change needs documentation Run only one system Only runs spread tests on one system labels Feb 25, 2026
@github-actions github-actions bot added the Needs Documentation -auto- Label automatically added which indicates the change needs documentation label Feb 25, 2026
@github-actions
Copy link

github-actions bot commented Feb 25, 2026

Fri Feb 27 20:13:40 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/22411362761

Failures:

Executing:

  • openstack-ext:ubuntu-26.04-64:tests/nested/manual/minimal-smoke:secboot_disabled
  • openstack-ext:ubuntu-26.04-64:tests/nested/manual/minimal-smoke:secboot_enabled
  • openstack-ext:ubuntu-26.04-64:tests/nested/core/remount-hotplug
  • openstack:ubuntu-25.10-64:tests/main/apparmor-prompting-flag-restart

Restoring:

  • openstack:ubuntu-25.10-64:tests/main/apparmor-prompting-flag-restart

Skipped tests from snapd-testing-skip

  • openstack:ubuntu-24.04-64:tests/main/i18n

… handling

Remove the SnapdRestart interface and its implementations as it is not needed
anymore (restart.Restart is now called by daemon.Stop). Update function
signatures for AddSnapdSnapServices and GenerateSnapdWrappers to return only
error instead of (SnapdRestart, error). Simplify related code that previously
handled restart callbacks after symlink updates.
@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 26.66667% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.52%. Comparing base (13af338) to head (7619b7c).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
wrappers/core18.go 0.00% 29 Missing ⚠️
daemon/daemon.go 40.00% 2 Missing and 1 partial ⚠️
overlord/snapstate/backend/link.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16676      +/-   ##
==========================================
- Coverage   77.58%   77.52%   -0.07%     
==========================================
  Files        1344     1355      +11     
  Lines      186593   186995     +402     
  Branches     2449     2449              
==========================================
+ Hits       144769   144968     +199     
- Misses      33068    33260     +192     
- Partials     8756     8767      +11     
Flag Coverage Δ
unittests 77.52% <26.66%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pedronis pedronis requested a review from bboozzoo February 26, 2026 08:21
Copy link
Contributor

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question

}
d.overlord.Stop()

if d.requestedRestart == restart.RestartDaemon {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this go after the if below?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Documentation -auto- Label automatically added which indicates the change needs documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants