mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 09:26:03 +00:00
feat(instances): a VM a fault stopped or paused says why
libvirt gives each state its reason; the panel showed only the state, so a VM QEMU paused because its storage filled up read "Suspended" like one an administrator paused. - instances.states.REASONS: the fault reasons told (disk error, watchdog, guest crash or kernel panic, a crash of the guest or its QEMU process, libvirt stopping it after a restart, failed post-copy migration, libvirt error, failed start); the ordinary ones (user, migration, snapshot) are not - the lists read the reason with the state in their one getAllDomainStats call (get_domain_rows, get_domain_states: a change of reason reloads a list) and show it under the state badge - the VM page reads state and reason in one virDomainGetState (a reason means something only with its own state) and tells it in an alert; a VM paused by a disk error names each disk and what it met (virDomainGetDiskErrors), and when a storage has no free space, what to do: an administrator frees space and resumes it. Disk errors are read only then: libvirt keeps the last one after a resume. The page's poll reloads on a change of reason too Checked live on a Vagrant host: a guest filling a disk on a 40 MiB pool was paused (I/O error, vda: no space); the page said so, and after the pool grew and the VM was resumed the alert was gone.
This commit is contained in:
parent
7408a575d6
commit
bdc5569cc8
17 changed files with 330 additions and 18 deletions
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
{% block content %}
|
||||
{# the VM at a glance in one card: who and where it is, what it has, and its sections as the card's footer #}
|
||||
<section class="card mb-3" aria-labelledby="vm-name" id="vm-summary" data-status="{{ instance.status }}"
|
||||
<section class="card mb-3" aria-labelledby="vm-name" id="vm-summary" data-status="{{ instance.status }}" data-reason="{{ instance.state_and_reason.1 }}"
|
||||
data-status-url="{% url 'instances:status' instance.id %}" data-osinfo-url="{% url 'instances:osinfo' instance.id %}"
|
||||
data-opens-on="{% if instance.is_template and can_clone %}#clone{% endif %}"
|
||||
data-random-mac-url="{% url 'instances:random_mac_address' %}"
|
||||
|
|
@ -46,6 +46,16 @@
|
|||
</div>
|
||||
{# shown by instance_status.js while the VM's state cannot be read #}
|
||||
<div class="alert alert-warning small py-2 mt-2 mb-0" id="vm-host-lost" role="status" hidden>{% trans "This page could not be refreshed: its state and figures may be out of date." %}</div>
|
||||
{# a VM a fault stopped or paused says why; a full storage pauses it until there is space #}
|
||||
{% if instance.state_reason %}
|
||||
<div class="alert alert-danger small py-2 mt-2 mb-0" role="status">
|
||||
<strong>{{ instance.state_reason }}</strong>
|
||||
{% for error in instance.disk_error_texts %}<div>{{ error }}</div>{% endfor %}
|
||||
{% if instance.disk_full %}
|
||||
<div>{% if request.user.is_superuser %}{% trans "Free space on its storage, then resume it." %}{% else %}{% trans "An administrator has to free space on its storage and resume it." %}{% endif %}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if not instance.is_template %}
|
||||
<div class="d-flex flex-wrap column-gap-3 row-gap-1 small mt-2">
|
||||
{% if not instance.guest_agent %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue