1
0
Fork 0
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:
catborise 2026-11-10 10:58:12 +03:00
parent 6cdda6d4f3
commit 139e43e4c4
7 changed files with 358 additions and 335 deletions

View file

@ -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"},