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

Implemented memallocratio tag

parent dbd39755
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', 'cpuallocratio', 'memalloc', 'memrunning', 'memremaining'):
for tag in ('cpualloc', 'cpurunning', 'cpuremaining', 'cpuallocratio', 'memalloc', 'memrunning', 'memremaining', 'memallocratio'):
self.tag_db['__main__'][tag].update_value()
# register libvirt handlers
......
......@@ -199,4 +199,12 @@ def memremaining(handl):
"""Allocatable memory remaining on the hypervisor."""
mem = int(handl.tag_db['__main__']['mem'].value)
memalloc = int(handl.tag_db['__main__']['memalloc'].value)
return mem - memalloc
\ No newline at end of file
return mem - memalloc
@_check_virt_connected
def memallocratio(handl):
"""Allocated memory ratio on the hypervisor."""
mem = float(handl.tag_db['__main__']['mem'].value)
memalloc = float(handl.tag_db['__main__']['memalloc'].value)
return '%0.2f' % (memalloc / mem)
\ No newline at end of file
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