Francesco Romani has uploaded a new change for review. Change subject: virt: faster getVMList ......................................................................
virt: faster getVMList avoid (apparently?) wasteful work and make the verb implementation faster with no changes in behaviour. Change-Id: I82c602301bc133d6a4971c8a4d15f823929f7c43 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/API.py M vdsm/virt/vm.py 2 files changed, 4 insertions(+), 10 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/39/35139/1 diff --git a/vdsm/API.py b/vdsm/API.py index 1ef4b00..f3afc9e 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1365,18 +1365,10 @@ # VM-related functions def getVMList(self, fullStatus=False, vmList=()): """ return a list of known VMs with full (or partial) config each """ - - def reportedStatus(v, full): - d = v.status() - if full: - return d - else: - return {'vmId': d['vmId'], 'status': d['status']} - # To improve complexity, convert 'vms' to set(vms) vmSet = set(vmList) return {'status': doneCode, - 'vmList': [reportedStatus(v, fullStatus) + 'vmList': [v.status(fullStatus) for v in self._cif.vmContainer.values() if not vmSet or v.id in vmSet]} diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index b6922a5..fbbc22d 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -2213,7 +2213,9 @@ pass self.saveState() - def status(self): + def status(self, fullStatus=True): + if not fullStatus: + return {'vmId': self.id, 'status': self.lastStatus} # used by API.Global.getVMList self.conf['status'] = self.lastStatus with self._confLock: -- To view, visit http://gerrit.ovirt.org/35139 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I82c602301bc133d6a4971c8a4d15f823929f7c43 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
