Commit dbd39755 authored by Antoine Millet's avatar Antoine Millet
Browse files

Implemented cpuallocratio tag

parent 263a1380
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+8 −0
Original line number Diff line number Diff line
@@ -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."""