mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
connection: Don't fetch domain XML for memory stats
Make sure we are returning mem values from info(), not from XML
This commit is contained in:
parent
b5023268a4
commit
5570851998
@ -1525,7 +1525,7 @@ class vmmConnection(vmmGObject):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
cpuTime += vm.cpu_time()
|
cpuTime += vm.cpu_time()
|
||||||
mem += vm.get_memory()
|
mem += vm.stats_memory()
|
||||||
rdRate += vm.disk_read_rate()
|
rdRate += vm.disk_read_rate()
|
||||||
wrRate += vm.disk_write_rate()
|
wrRate += vm.disk_write_rate()
|
||||||
rxRate += vm.network_rx_rate()
|
rxRate += vm.network_rx_rate()
|
||||||
|
@ -755,6 +755,8 @@ class vmmDomainBase(vmmLibvirtObject):
|
|||||||
return status
|
return status
|
||||||
|
|
||||||
def _sample_mem_stats(self, info):
|
def _sample_mem_stats(self, info):
|
||||||
|
currmem = info[2]
|
||||||
|
maxmem = info[1]
|
||||||
pcentCurrMem = info[2] * 100.0 / self.connection.host_memory_size()
|
pcentCurrMem = info[2] * 100.0 / self.connection.host_memory_size()
|
||||||
pcentMaxMem = info[1] * 100.0 / self.connection.host_memory_size()
|
pcentMaxMem = info[1] * 100.0 / self.connection.host_memory_size()
|
||||||
|
|
||||||
@ -763,7 +765,7 @@ class vmmDomainBase(vmmLibvirtObject):
|
|||||||
if pcentMaxMem > 100:
|
if pcentMaxMem > 100:
|
||||||
pcentMaxMem = 100.0
|
pcentMaxMem = 100.0
|
||||||
|
|
||||||
return pcentCurrMem, pcentMaxMem
|
return pcentCurrMem, pcentMaxMem, currmem, maxmem
|
||||||
|
|
||||||
def _sample_cpu_stats(self, info, now):
|
def _sample_cpu_stats(self, info, now):
|
||||||
prevCpuTime = 0
|
prevCpuTime = 0
|
||||||
@ -814,7 +816,7 @@ class vmmDomainBase(vmmLibvirtObject):
|
|||||||
def stats_memory(self):
|
def stats_memory(self):
|
||||||
if not self.is_active():
|
if not self.is_active():
|
||||||
return 0
|
return 0
|
||||||
return self.get_memory()
|
return self._get_record_helper("curmem")
|
||||||
|
|
||||||
def stats_memory_pretty(self):
|
def stats_memory_pretty(self):
|
||||||
if not self.is_active():
|
if not self.is_active():
|
||||||
@ -1504,7 +1506,8 @@ class vmmDomain(vmmDomainBase):
|
|||||||
info[1] = self.connection.host_memory_size()
|
info[1] = self.connection.host_memory_size()
|
||||||
|
|
||||||
cpuTime, cpuTimeAbs, pcentCpuTime = self._sample_cpu_stats(info, now)
|
cpuTime, cpuTimeAbs, pcentCpuTime = self._sample_cpu_stats(info, now)
|
||||||
pcentCurrMem, pcentMaxMem = self._sample_mem_stats(info)
|
(pcentCurrMem, pcentMaxMem,
|
||||||
|
curmem, maxmem) = self._sample_mem_stats(info)
|
||||||
rdBytes, wrBytes = self._disk_io()
|
rdBytes, wrBytes = self._disk_io()
|
||||||
rxBytes, txBytes = self._network_traffic()
|
rxBytes, txBytes = self._network_traffic()
|
||||||
|
|
||||||
@ -1513,6 +1516,8 @@ class vmmDomain(vmmDomainBase):
|
|||||||
"cpuTime": cpuTime,
|
"cpuTime": cpuTime,
|
||||||
"cpuTimeAbs": cpuTimeAbs,
|
"cpuTimeAbs": cpuTimeAbs,
|
||||||
"cpuTimePercent": pcentCpuTime,
|
"cpuTimePercent": pcentCpuTime,
|
||||||
|
"curmem": curmem,
|
||||||
|
"maxmem": maxmem,
|
||||||
"currMemPercent": pcentCurrMem,
|
"currMemPercent": pcentCurrMem,
|
||||||
"maxMemPercent": pcentMaxMem,
|
"maxMemPercent": pcentMaxMem,
|
||||||
"diskRdKB": rdBytes / 1024,
|
"diskRdKB": rdBytes / 1024,
|
||||||
|
Loading…
Reference in New Issue
Block a user