1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00
webvirtcloud/vmbackups/templates/vmbackups/vm_tab.html
catborise df11685037 fix(vmbackups): second audit: a frozen guest, refused copies, stuck deletes, lists
Codex's audit of the module, each fix tested:
- a backup cancelled while its guest stayed frozen ends through recovery,
  which thaws the guest first, not as a cancel that never thaws it;
- a restore copy libvirt refuses fails and removes the copies, instead of
  waiting on an administrator as an unknown outcome;
- a deletion that did not end can be asked again from the page;
- recovery starts a restored VM the restore was asked to start;
- a manifest with a bad UUID no longer stops reading the target's others;
- an owner is not linked to a job only its submitter or a superuser opens.

From the browser audit: with a long VM name the backup list pushed the
state and the actions out of view, and on a phone only the time and VM
showed. The list folds the target under the time and the schedule under
the VM, cuts long names (whole on hover), shows the restore menu as an
icon on a phone, and fits from 390 px up. An owner without a backup quota
is told so, and quota sizes never read 0.0 GiB.
2026-11-18 07:29:36 +03:00

64 lines
4.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% load i18n %}
{% load operations %}
{% load bootstrap_icons %}
{% load static %}
<div class="tab-pane" id="backups" role="tabpanel">
<div class="card">
<div class="card-body">
{% if backups.problem %}
<div class="alert alert-warning" role="status">{% bs_icon 'exclamation-triangle' %} {{ backups.problem }}</div>
{% else %}
<form action="{% url 'vmbackups:create' instance.id %}" method="post" aria-label="{% trans "Back up now" %}">{% csrf_token %}{% submission_key %}
<div class="row g-2 align-items-center">
<div class="col-12 col-md">
<label class="visually-hidden" for="backup-target">{% trans "Backup target" %}</label>
<select class="form-select" id="backup-target" name="target" required>
{% for target in backups.targets %}<option value="{{ target.id }}">{{ target.name }}</option>{% endfor %}
</select>
</div>
<div class="col-12 col-md-auto">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="frozen" id="backup-frozen"{% if instance.status != 1 or not instance.guest_agent_ready %} disabled{% endif %}>
<label class="form-check-label" for="backup-frozen">{% trans "Require frozen file systems" %}</label>
</div>
</div>
<div class="col-12 col-md-auto d-grid">
<button type="submit" class="btn btn-primary">{% bs_icon 'archive' %} {% trans "Back up now" %}</button>
</div>
</div>
<p class="small text-body-secondary mt-2 mb-0">{% blocktrans %}A running VM keeps running: its disks are copied from one instant, its file systems frozen for that instant when the guest agent answers, otherwise the backup is crash-consistent. Memory is not kept.{% endblocktrans %}</p>
</form>
{% endif %}
{% if backups.schedules %}
<p class="small mt-3 mb-0">{% trans "Schedules:" %}
{% for policy in backups.schedules %}<a href="{% url 'vmbackups:policy' policy.id %}">{{ policy.name }}</a> ({{ policy.time|time:"H:i" }}){% if not policy.enabled %} <span class="badge text-bg-secondary">{% trans "Disabled" %}</span>{% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
</p>
{% endif %}
{% if backups.rows %}
<div class="table-responsive mt-3">
<table class="table table-sm align-middle mb-0">
<thead>
<tr><th>{% trans "Time" %}</th><th class="d-none d-md-table-cell">{% trans "Target" %}</th><th class="d-none d-sm-table-cell">{% trans "Consistency" %}</th><th class="text-end d-none d-sm-table-cell">{% trans "Size" %}</th><th>{% trans "State" %}</th><th></th></tr>
</thead>
<tbody>
{% for backup in backups.rows %}
<tr>
<td class="text-nowrap">{{ backup.created_at|date:"Y-m-d H:i" }}</td>
<td class="d-none d-md-table-cell">{{ backup.target.name }}</td>
<td class="d-none d-sm-table-cell">{% include "vmbackups/consistency.html" %}</td>
<td class="text-end text-nowrap d-none d-sm-table-cell">{% if backup.size %}{{ backup.size|filesizeformat }}{% else %}–{% endif %}</td>
<td>{% include "vmbackups/state.html" with pending_deletes=backups.pending_deletes %}</td>
<td class="text-end">{% include "vmbackups/delete_form.html" with pending_deletes=backups.pending_deletes %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="text-body-secondary mt-3 mb-0">{% trans "No backup of this VM yet." %}</p>
{% endif %}
</div>
</div>
</div>
<script src="{% static 'vmbackups/pending.js' %}"></script>