Skip to content
Snippets Groups Projects
Commit dbd39755 authored by Antoine Millet's avatar Antoine Millet
Browse files

Implemented cpuallocratio tag

parent 263a1380
No related branches found
No related tags found
No related merge requests found
......@@ -125,7 +125,7 @@ class Handler(HostHandler):
# we must refresh those tags only when domains tags are registered to
# have the calculated values
for tag in ('cpualloc', 'cpurunning', 'cpuremaining', 'memalloc', 'memrunning', 'memremaining'):
for tag in ('cpualloc', 'cpurunning', 'cpuremaining', 'cpuallocratio', 'memalloc', 'memrunning', 'memremaining'):
self.tag_db['__main__'][tag].update_value()
# register libvirt handlers
......
......@@ -171,6 +171,14 @@ def cpuremaining(handl):
return cpu - cpualloc
@_check_virt_connected
def cpuallocratio(handl):
"""Allocated CPU ratio on the hypervisor."""
cpu = float(handl.tag_db['__main__']['cpu'].value)
cpualloc = float(handl.tag_db['__main__']['cpualloc'].value)
return '%0.2f' % (cpualloc / cpu)
@_check_virt_connected
def memrunning(handl):
"""Memory used by running VMs on the hypervisor."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment