Change in vdsm[master]: virt: faster getAllVmStats

fromani at redhat.com fromani at redhat.com
Thu Nov 13 16:14:28 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: virt: faster getAllVmStats
......................................................................

virt: faster getAllVmStats

avoid (apparently?) wasteful work and make
the verb implementation faster with no
changes in behaviour.

Change-Id: If1ed3f49c236086c6184973762d9909d7f79bf7e
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/API.py
M vdsm/virt/vm.py
2 files changed, 2 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/35140/1

diff --git a/vdsm/API.py b/vdsm/API.py
index f3afc9e..f934754 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1288,12 +1288,7 @@
         Get statistics of all running VMs.
         """
         hooks.before_get_all_vm_stats()
-        vms = self.getVMList()
-        statsList = []
-        for s in vms['vmList']:
-            response = VM(s['vmId']).getStats(runHooks=False)
-            if response:
-                statsList.append(response['statsList'][0])
+        statsList = [v.getStats() for v in self._cif.vmContainer.values()]
         statsList = hooks.after_get_all_vm_stats(statsList)
         return {'status': doneCode, 'statsList': statsList}
 
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index fbbc22d..6d39da2 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2260,6 +2260,7 @@
         but can change as result as interaction with libvirt (display*)
         """
         stats = {
+            'vmId': self.conf['vmId'],
             'pid': self.conf['pid'],
             'vmType': self.conf['vmType'],
             'kvmEnable': self._kvmEnable,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If1ed3f49c236086c6184973762d9909d7f79bf7e
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list