1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 11:16:47 +00:00
webvirtcloud/computes
catborise 5bc8b1915e fix(instances): every VM state has a label and the actions it allows
The instance lists, the VM page header and the power tab knew three
libvirt states: running, paused and shut off. A VM that was blocked,
shutting down, crashed, suspended by its guest or without a state got
an empty status cell and no actions, so a crashed VM could not even be
forced off from the list. The lists also offered actions users could
not use: Suspend and Resume (views for superusers) to everyone, and
power actions to users who see every VM through the read-only
view_instances permission.

instances/states.py holds the rules in one place: the label and color
of each state, the actions each state allows, and which of them a user
may use (superusers all; a VM's owners all but suspend and resume, and
nothing on a VM an administrator suspended, as the VM page already
showed; nobody else any). Blocked is a running VM; shutting down,
crashed and suspended by the guest get Force Off, after which the VM
can be started. A shut-off template offers Clone to whoever has the
clone permission, as the clone view allows.

The templates read them through two tags (vm_states): the lists and the
VM page header show the state, instance_actions.html has one slot per
button, each enabled or disabled from the allowed actions. The power
tab offers Force Off in the states that need it.

The new tests check the rules directly and render every state in the
lists and on the VM page for a superuser, an owner and a
view_instances user; they fail on the previous code.
2026-10-05 19:34:30 +03:00
..
api fix(api): typed URLs and accurate response schemas 2026-10-04 01:08:11 +03:00
migrations Added missing migrations 2020-06-15 12:38:44 +06:00
templates fix(instances): every VM state has a label and the actions it allows 2026-10-05 19:34:30 +03:00
__init__.py Initial commit 2015-02-27 10:53:51 +02:00
apps.py fix: track migrations; installs apply them instead of generating them 2026-10-04 01:08:11 +03:00
forms.py format python code with black 2022-11-02 08:54:35 +03:00
models.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
test_api_security.py fix(instances): disk edits keep their XML; changes lock per VM 2026-10-04 01:08:11 +03:00
test_operation_locks.py fix(instances): disk edits keep their XML; changes lock per VM 2026-10-04 01:08:11 +03:00
test_overview_status.py fix(computes): overview state comes from the connection 2026-10-05 11:10:01 +03:00
test_ownership.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
test_quota_down_host.py fix(instances): the quota counts every VM and refuses what it cannot verify 2026-10-05 12:26:57 +03:00
test_reconciliation.py fix(computes): instance sync asks libvirt outside the DB transaction 2026-10-05 10:47:35 +03:00
tests.py fix(vrtManager): libvirt connections open within a time limit 2026-10-05 09:06:52 +03:00
urls.py chore: drop references to the local roadmap from code and tests 2026-10-04 11:09:25 +03:00
utils.py fix(computes): instance sync asks libvirt outside the DB transaction 2026-10-05 10:47:35 +03:00
validators.py format python code with black 2022-11-02 08:54:35 +03:00
views.py fix(computes): overview state comes from the connection 2026-10-05 11:10:01 +03:00