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.
A VM undefined outside the panel (virsh, virt-manager) while its page was
open made the state and statistics polls answer 500 every 5 seconds, each
an error in the panel's log, and the page stayed as it was. A page read of
an object the host no longer has is now 404, and the VM page reloads on a
404 of its state: it then goes to the VM list with "no longer on its host",
or shows that the VM is not found.
The VM page polls the VM's state every 5 s and reloads when it changes.
When the host stopped answering, the poll failed and nothing changed on
the page: it kept showing the last state, figures and actions as if they
were current. A notice now says that the page could not be refreshed and
may be out of date while the poll fails (a host that does not answer, a
session that ended); it goes away with the next answer. Checked on
compute1 in headless Chromium with its libvirt port dropped and restored.
A power state change reloaded the VM page at once, losing what the user
was typing in a form or a dialog left open (only an unsaved XML edit was
kept). It now waits while pageInUse(), as the VM list's poll does.
The VM page's thirteen inline script blocks and its inline handlers move
to static files: instance_page.js (tabs, OS details, clone names and
MACs, Add disk dialog, boot order, host devices, migrate plan, console
window, switches that send their form), instance_stats.js (charts and
the Logs view) and instance_status.js (the reload when the VM's state
changes). Their values and messages come as data attributes of the
elements they belong to, page-wide ones on #vm-summary; a form marked
data-please-wait shows the please-wait dialog. Three blocks that did
nothing are dropped: popovers (the page has none), the video model
preselection (the server selects it) and the delete form's poll stop
(that form is on the destroy page). The HTML sink inventory now also
reads the app's own scripts.