1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00

fix(instances): a disk form loaded before the disk changed changes nothing

The Edit, Detach and Delete forms of a VM's disk name it by its device:
the view acted on whatever disk had that device by then. A form loaded
before a disk move, an external snapshot or another tab's change wrote the
old path back over the new one (the VM then starts from an old or deleted
file), or detached and deleted the volume that replaced it.

The forms already send the path they show. The views now refuse a disk
whose path is not that one, and tell the user to reload the page. Turkish
and Chinese texts included.

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-11 12:39:40 +03:00
parent a53a3623d2
commit 34048dce83
10 changed files with 433 additions and 374 deletions

View file

@ -227,7 +227,7 @@
<div class="col-12 col-md-4 d-flex flex-wrap justify-content-md-end gap-2">
<form class="d-inline" action="{% url 'instances:edit_volume' instance.id %}" method="post" aria-label="{% trans "Edit instance volume form" %}">
{% csrf_token %}
<input type="hidden" name="path" value="{{ disk.path }}">
<input type="hidden" name="path" value="{{ disk.path|default:'' }}">
<input type="hidden" name="dev" value="{{ disk.dev }}">
<input type="hidden" name="storage" value="{{ disk.storage }}">
<input type="hidden" name="name" value="{{ disk.image }}">
@ -236,7 +236,7 @@
{% if request.user.is_superuser %}{% include 'instances/move_disk.html' with id=forloop.counter0 %}{% endif %}
<form class="d-inline" action="{% url 'instances:detach_vol' instance.id %}" method="post">
{% csrf_token %}
<input type="hidden" name="path" value="{{ disk.path }}">
<input type="hidden" name="path" value="{{ disk.path|default:'' }}">
<input type="hidden" name="dev" value="{{ disk.dev }}">
<input type="hidden" name="storage" value="{{ disk.storage }}">
<input type="hidden" name="name" value="{{ disk.image }}">
@ -244,7 +244,7 @@
</form>
<form class="d-inline" action="{% url 'instances:delete_vol' instance.id %}" method="post">
{% csrf_token %}
<input type="hidden" name="path" value="{{ disk.path }}">
<input type="hidden" name="path" value="{{ disk.path|default:'' }}">
<input type="hidden" name="dev" value="{{ disk.dev }}">
<input type="hidden" name="storage" value="{{ disk.storage }}">
<input type="hidden" name="name" value="{{ disk.image }}">