Skip to content

qubesos: add force parameter to shutdown and restarted states#40

Merged
marmarek merged 1 commit into
QubesOS:mainfrom
Guiiix:shutdown-force
May 15, 2026
Merged

qubesos: add force parameter to shutdown and restarted states#40
marmarek merged 1 commit into
QubesOS:mainfrom
Guiiix:shutdown-force

Conversation

@Guiiix

@Guiiix Guiiix commented May 14, 2026

Copy link
Copy Markdown
Member

This PR is based on the original work from @jmynes in PR #36 rebased on top of the current main branch.

The force parameter is added to both legacy qubesos and qubesos.core.qube modules.

Thanks to @jmynes for the original contribution.

@Guiiix Guiiix force-pushed the shutdown-force branch 2 times, most recently from 9c0c36f to 3e6e00e Compare May 14, 2026 14:01
@codecov-commenter

codecov-commenter commented May 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.72%. Comparing base (1411527) to head (2561a08).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   83.64%   83.72%   +0.07%     
==========================================
  Files           1        1              
  Lines         214      215       +1     
==========================================
+ Hits          179      180       +1     
  Misses         35       35              
Flag Coverage Δ
unittests 83.72% <100.00%> (+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.

@marmarek marmarek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, but will need adjusting tests after #42

Exposes qubesadmin.vm.QubesVM.shutdown(force=True) through a new
module parameter. When force: true is set alongside state: shutdown
(or state: restarted), the target VM halts gracefully regardless
of whether other VMs are connected to it (e.g. AppVMs using it as
a netvm). This matches the semantics of qvm-shutdown --force on
the CLI.

Distinct from state: destroyed, which calls vm.kill() (a SIGKILL
of the Xen domain with no graceful shutdown). The force parameter
only skips the "connected domains" precondition; the target itself
still halts gracefully, as it does with state: shutdown today.

The default is force=false, preserving current behavior. Adds a
pytest case in tests/qubes/test_module.py that exercises the new
parameter against a running dependent VM.

Refs: QubesOS/qubes-issues#10856

Co-authored-by: Guillaume Chinal <guiiix@invisiblethingslab.com>
@Guiiix

Guiiix commented May 15, 2026

Copy link
Copy Markdown
Member Author

Thanks! Rebase done

@marmarek marmarek merged commit e144397 into QubesOS:main May 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants