qubesos: add force parameter to shutdown and restarted states#36
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
=======================================
Coverage 73.34% 73.34%
=======================================
Files 1 1
Lines 529 529
=======================================
Hits 388 388
Misses 141 141
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
67f602b to
05d292a
Compare
|
Suggestion: If you intend for this pull request to resolve the associated issue and would like for it to be linked to the issue automatically, you can put |
|
Closes QubesOS/qubes-issues#10856 (Accidentally mentioned 10586, deleted comment, then posted fixed comment) |
You have to edit your first post (at the very top) and add this there in order for this to work. |
|
Hi @jmynes! Thanks for your contribution. The module has been refactored to a new module |
* origin/pr/40: qubesos: add force parameter to shutdown and restarted states Pull request description: 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.
Adds a
forceparameter to the qubesos module'sstate: shutdown/state: restarted, passed through toqubesadmin.vm.QubesVM.shutdown(force=True). Equivalent toqvm-shutdown --force: the target halts even when other VMs are connected to it.Default is false, so existing playbooks are unaffected.
state: destroyedstill doesvm.kill()(hard kill), unchanged.Test added using the existing
vm+netvmfixtures.Refs QubesOS/qubes-issues#10856