mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
perf(instances): a VM page does not wait for the guest agent's addresses
A running VM's page read its addresses while it rendered: the guest agent, when its channel is connected but it does not answer, holds the page (and a gunicorn worker) for its whole 10 s timeout, on every load. The page now shows them once it has loaded: vm_addresses.js asks the new instances/<pk>/addresses/ for each NIC's addresses and fills the header's IPv4 and each network card's IPv4 and IPv6.
This commit is contained in:
parent
bf736942eb
commit
aab8dbf1df
18 changed files with 600 additions and 449 deletions
|
|
@ -296,7 +296,6 @@ def _instance_page(request, pk, instance, compute):
|
|||
if can_manage_console:
|
||||
console_form = ConsoleForm(instance=instance, is_superuser=request.user.is_superuser)
|
||||
console_listener_addresses = settings.QEMU_CONSOLE_LISTENER_ADDRESSES
|
||||
ipv4_addresses = [address for net in instance.networks for address in net["ipv4"] or []]
|
||||
try:
|
||||
userinstance = UserInstance.objects.get(instance=instance, user=request.user)
|
||||
except UserInstance.DoesNotExist:
|
||||
|
|
@ -390,6 +389,18 @@ def status(request, pk):
|
|||
return JsonResponse({"status": instance.proxy.get_status()})
|
||||
|
||||
|
||||
def nic_addresses(request, pk):
|
||||
"""The VM's addresses by MAC, which its page shows once it has loaded
|
||||
(vm_addresses.js): the guest agent may take its whole timeout. A host
|
||||
that cannot be read gives none."""
|
||||
instance = get_instance(request.user, pk)
|
||||
try:
|
||||
found = instance.proxy.get_addresses()
|
||||
except libvirtError:
|
||||
found = {}
|
||||
return JsonResponse({mac: {"ipv4": ipv4 or [], "ipv6": ipv6 or []} for mac, (ipv4, ipv6) in found.items()})
|
||||
|
||||
|
||||
def _valid_ssh_target(compute):
|
||||
"""The login and hostname reach ssh as a command-line argument; a compute
|
||||
whose values would inject an ssh option (an existing or bypassed row that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue