mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 19:26:48 +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
|
|
@ -795,15 +795,11 @@ class wvmInstance(wvmConnect):
|
|||
pcpus = hostinfo[4] * hostinfo[5] * hostinfo[6] * hostinfo[7]
|
||||
return range(1, max(int(pcpus), at_least) + 1)
|
||||
|
||||
def get_interface_addresses(self, iface_mac):
|
||||
"""The running VM's addresses of the NIC with iface_mac: (IPv4, IPv6
|
||||
with prefix), from the guest agent when it has some, else from the
|
||||
host's ARP table; (None, None) when neither has one. Read once in a
|
||||
cached_reads block: the agent may take its whole timeout."""
|
||||
return self._cached("addresses", self._read_addresses).get(iface_mac, (None, None))
|
||||
|
||||
def _read_addresses(self):
|
||||
"""{MAC: (IPv4 list, IPv6 list)}: each MAC's addresses from the first source that has some."""
|
||||
def get_addresses(self):
|
||||
"""The running VM's addresses, {MAC: (IPv4 list, IPv6 list with
|
||||
prefix)}, each MAC's from the first source that has some: the guest
|
||||
agent, else the host's ARP table. The agent may take its whole
|
||||
timeout: the VM page reads them after it loads (views.nic_addresses)."""
|
||||
if self.get_status() != 1:
|
||||
return {}
|
||||
sources = []
|
||||
|
|
@ -856,10 +852,6 @@ class wvmInstance(wvmConnect):
|
|||
out_burst = out_attr.get("burst")
|
||||
outbound = {"average": out_av, "peak": out_peak, "burst": out_burst}
|
||||
|
||||
try:
|
||||
ipv4, ipv6 = self.get_interface_addresses(mac_inst)
|
||||
except libvirtError:
|
||||
ipv4, ipv6 = None, None
|
||||
result.append(
|
||||
{
|
||||
"type": interface_type,
|
||||
|
|
@ -868,8 +860,6 @@ class wvmInstance(wvmConnect):
|
|||
"target": target_inst,
|
||||
"state": link_state,
|
||||
"model": model_type,
|
||||
"ipv4": ipv4,
|
||||
"ipv6": ipv6,
|
||||
"filterref": filterref_inst,
|
||||
"inbound": inbound,
|
||||
"outbound": outbound,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue