mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-01 16:36:06 +00:00
fix(instances): the VM page says when its host stops answering
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. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
parent
6cdda6d4f3
commit
139e43e4c4
7 changed files with 358 additions and 335 deletions
|
|
@ -43,6 +43,8 @@
|
|||
<a class="btn btn-sm btn-secondary" href="{% url 'instances:instance' instance.id %}">{% bs_icon 'arrow-clockwise' %} {% trans "Refresh" %}</a>
|
||||
</div>
|
||||
</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>
|
||||
{% 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 %}
|
||||
|
|
|
|||
|
|
@ -276,6 +276,12 @@ class PendingEditsTestCase(TestCase):
|
|||
User.objects.filter(username="pe-new").delete() # no one left to add: no search box to load
|
||||
self.assertNotIn("/static/js/searchable_select.js", self.page().xpath("//script/@src"))
|
||||
|
||||
def test_the_page_has_a_hidden_notice_for_a_host_that_stops_answering(self):
|
||||
# instance_status.js shows it while the state poll fails
|
||||
(notice,) = self.page().xpath("//div[@id='vm-host-lost']")
|
||||
self.assertIn("hidden", notice.attrib)
|
||||
self.assertIn("could not be refreshed", notice.text_content())
|
||||
|
||||
def test_a_paused_vm_offers_to_turn_vcpus_on_only(self):
|
||||
# unplugging a vCPU needs the guest, which a paused VM does not run
|
||||
vcpus = {"0": {"enabled": "yes", "hotpluggable": "no", "order": "1"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue