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

fix(instances): the VM page's DRBD state does not rewrite the VM's record

With VM DRBD Status on, the VM page saved the whole record it had read
after waiting up to its ssh timeout for the host. A migration or delete
that finished meanwhile was undone: the record moved back to the old
compute, or came back without its owners. Only the DRBD state is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-09 21:24:00 +03:00
parent 12e33f7964
commit b95f2a28d7
2 changed files with 14 additions and 1 deletions

View file

@ -342,7 +342,8 @@ def _instance_page(request, pk, instance, compute):
if app_settings.VM_DRBD_STATUS == "True":
instance.drbd = drbd_status(request, pk)
instance.save()
# the state alone: a whole-row save would undo a migration or delete finished meanwhile
Instance.objects.filter(pk=instance.pk).update(drbd=instance.drbd)
usb_hostdevs, pci_hostdevs, other_hostdevs = instance.proxy.get_hostdevs()
if usb_hostdevs or pci_hostdevs: