mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
perf(computes): the host's info is read once per request
The overview read the host's info four times, now once (12 libvirt calls). A connection object keeps it next to the capabilities, and the VM page and VM stats take it from there; the VM page's cached_reads block holds only the VM's own data. Free memory is still read each time.
This commit is contained in:
parent
9adc808d26
commit
57f592df70
6 changed files with 57 additions and 32 deletions
|
|
@ -34,7 +34,7 @@ class wvmHostDetails(wvmConnect):
|
|||
"""
|
||||
Function return memory usage on node.
|
||||
"""
|
||||
all_mem = self.wvm.getInfo()[1] * 1048576
|
||||
all_mem = self.host_info[1] * 1048576
|
||||
freemem = self.wvm.getMemoryStats(-1, 0)
|
||||
if isinstance(freemem, dict):
|
||||
free = (freemem["buffers"] + freemem["free"] + freemem["cached"]) * 1024
|
||||
|
|
@ -78,9 +78,9 @@ class wvmHostDetails(wvmConnect):
|
|||
Function return host server information: hostname, cpu, memory, ...
|
||||
"""
|
||||
info = [self.wvm.getHostname()] # hostname
|
||||
info.append(self.wvm.getInfo()[0]) # architecture
|
||||
info.append(self.wvm.getInfo()[1] * 1048576) # memory
|
||||
info.append(self.wvm.getInfo()[2]) # cpu core count
|
||||
info.append(self.host_info[0]) # architecture
|
||||
info.append(self.host_info[1] * 1048576) # memory
|
||||
info.append(self.host_info[2]) # cpu core count
|
||||
info.append(
|
||||
get_xml_path(self.wvm.getSysinfo(0), func=cpu_version)
|
||||
) # cpu version
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue