Laszlo Hornyak has uploaded a new change for review.

Change subject: report idle time for multiple vcpus
......................................................................

report idle time for multiple vcpus

The idle time is now on a 0-100 scale. If the VM has multiple vcpus and
the load goes over 100%, the cpuIdle will report no further increase in
load. This patch fixes this behavior and changes the returned value to
0-(vcpus*100) scale.

Change-Id: I3308858f5c27c3dd193cd981c43721fa1cd023d9
Signed-off-by: Laszlo Hornyak <[email protected]>
---
M vdsm/libvirtvm.py
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/92/7892/1

diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3306cc2..8ff3f5a 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -164,6 +164,7 @@
         return netSamples
 
     def _getCpuStats(self, stats):
+        nrOfCpus = self._vm._dom._dom.info()[3]
         stats['cpuSys'] = 0.0
         sInfo, eInfo, sampleInterval = self.sampleCpu.getStats()
 
@@ -173,7 +174,7 @@
             self._log.debug("CPU stats not available")
             stats['cpuUser'] = 0.0
 
-        stats['cpuIdle'] = max(0.0, 100.0 - stats['cpuUser'])
+        stats['cpuIdle'] = max(0.0, (100.0 * nrOfCpus) - stats['cpuUser'])
 
     def _getNetworkStats(self, stats):
         stats['network'] = {}


--
To view, visit http://gerrit.ovirt.org/7892
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3308858f5c27c3dd193cd981c43721fa1cd023d9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to