mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 16:36:06 +00:00
fix(computes): a compute is not edited while a job on it is admitted
A job resolves its compute's connection when it runs. Changing the compute's hostname meanwhile sent the job to another host, where a VM with the same UUID (a copy) could be deleted or changed instead. An edit now holds the compute as a delete does, and is refused while a job or VM operation on it is admitted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
a2f4d3fe06
commit
12e33f7964
3 changed files with 15 additions and 2 deletions
|
|
@ -179,7 +179,8 @@ def compute_update(request, compute_id):
|
|||
before = snapshot(compute)
|
||||
form = FormClass(request.POST or None, instance=compute)
|
||||
if form.is_valid():
|
||||
with audit(request, compute, subject, "change") as entry:
|
||||
# held as a delete holds it: a job on the compute keeps the host it was admitted for
|
||||
with audit(request, compute, subject, "change") as entry, utils.libvirt_compute_lock(compute):
|
||||
form.save()
|
||||
fields = changed_fields(before, snapshot(compute))
|
||||
entry.action = "change " + ", ".join(fields)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue