Fix memory allocation updates and add more debug
Previously, we were assigning memalloc/memprov/vcpualloc during an earlier phase using the main d_domain list. I'm not sure exactly why, but this was throwing off stats after a fence. Instead, set these values later on while parsing the actually-active VMs.
This commit is contained in:
parent
d6b8808448
commit
5f1432ccdd
|
@ -477,10 +477,6 @@ def collect_vm_stats(logger, config, zkhandler, this_node, queue):
|
||||||
fixed_d_domain = this_node.d_domain.copy()
|
fixed_d_domain = this_node.d_domain.copy()
|
||||||
for domain, instance in fixed_d_domain.items():
|
for domain, instance in fixed_d_domain.items():
|
||||||
if domain in this_node.domain_list:
|
if domain in this_node.domain_list:
|
||||||
# Add the allocated memory to our memalloc value
|
|
||||||
memalloc += instance.getmemory()
|
|
||||||
memprov += instance.getmemory()
|
|
||||||
vcpualloc += instance.getvcpus()
|
|
||||||
if instance.getstate() == "start" and instance.getnode() == this_node.name:
|
if instance.getstate() == "start" and instance.getnode() == this_node.name:
|
||||||
if instance.getdom() is not None:
|
if instance.getdom() is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -536,6 +532,11 @@ def collect_vm_stats(logger, config, zkhandler, this_node, queue):
|
||||||
continue
|
continue
|
||||||
domain_memory_stats = domain.memoryStats()
|
domain_memory_stats = domain.memoryStats()
|
||||||
domain_cpu_stats = domain.getCPUStats(True)[0]
|
domain_cpu_stats = domain.getCPUStats(True)[0]
|
||||||
|
|
||||||
|
# Add the allocated memory to our memalloc value
|
||||||
|
memalloc += instance.getmemory()
|
||||||
|
memprov += instance.getmemory()
|
||||||
|
vcpualloc += instance.getvcpus()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if debug:
|
if debug:
|
||||||
try:
|
try:
|
||||||
|
@ -667,6 +668,13 @@ def collect_vm_stats(logger, config, zkhandler, this_node, queue):
|
||||||
# Close the Libvirt connection
|
# Close the Libvirt connection
|
||||||
lv_conn.close()
|
lv_conn.close()
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
logger.out(
|
||||||
|
f"VM stats: doms: {len(running_domains)}; memalloc: {memalloc}; memprov: {memprov}; vcpualloc: {vcpualloc}",
|
||||||
|
state="d",
|
||||||
|
prefix="vm-thread",
|
||||||
|
)
|
||||||
|
|
||||||
queue.put(len(running_domains))
|
queue.put(len(running_domains))
|
||||||
queue.put(memalloc)
|
queue.put(memalloc)
|
||||||
queue.put(memprov)
|
queue.put(memprov)
|
||||||
|
|
Loading…
Reference in New Issue