1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00

fix: power jobs name their action, refuse what does not apply and recover by the VM's state

Audit and review (Codex) of the bulk power and disk I/O limit:
- the Jobs page showed "Power" for a start, a shut down and a force off
  alike: each is a job kind of its own (instance.start, .shutdown,
  .force_off) named by its action;
- forcing off a VM already shut off made libvirt refuse after the job had
  recorded its intent: it ended uncertain and kept the VM locked. Each job now
  refuses a VM its action does not apply to before anything changes, and
  recovery reads the VM's state (running after a start, shut off after a
  shut down or force off) instead of ending uncertain;
- the Jobs page left out its kind and state filters for owners, whom the VM
  list sends there: they apply to every user;
- a running NBD disk's tls, which libvirt fills in, no longer makes it
  another disk than the next start's;
- a disk whose running limit differs from the next start's shows both.
This commit is contained in:
catborise 2026-11-20 11:53:09 +03:00
parent 35c794c50c
commit b36f674542
14 changed files with 1045 additions and 849 deletions

View file

@ -713,11 +713,12 @@ def custom_iotune(disk):
def disk_source(disk):
"""A disk element's storage, to tell two definitions' disks apart: its type
and its source's attributes and hosts, not those a running VM adds (index)."""
and its source's attributes and hosts, not those a running VM adds (index,
and an NBD disk's tls, which libvirt fills in from the host's settings)."""
source = disk.find("source")
if source is None:
return disk.get("type"), ()
return (disk.get("type"), tuple(sorted((k, v) for k, v in source.attrib.items() if k != "index")),
return (disk.get("type"), tuple(sorted((k, v) for k, v in source.attrib.items() if k not in ("index", "tls"))),
tuple(tuple(sorted(host.attrib.items())) for host in source.findall("host")))