Francesco Romani has uploaded a new change for review. Change subject: vm: introduce real status() method ......................................................................
vm: introduce real status() method introduce a method to return only the minimum amount of information to give status of a VM, as it is already required by getVMList() verb. Change-Id: I5cea61b5f831d20e3da10c62d4092d296a1b6db4 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/API.py M vdsm/virt/vm.py 2 files changed, 7 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/34870/1 diff --git a/vdsm/API.py b/vdsm/API.py index 7fb6a04..4fa4e45 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.getConf() - 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.getConf() if fullStatus else v.status() 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 e37bf7d..90f8b4d 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -2209,6 +2209,12 @@ status['guestDiskMapping'] = self.guestAgent.guestDiskMapping return status + def status(self): + # used by API.Global.getVMList + return { + 'vmId': self.id, + 'status': self.lastStatus} + def getStats(self): """ used by API.Vm.getStats -- To view, visit http://gerrit.ovirt.org/34870 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5cea61b5f831d20e3da10c62d4092d296a1b6db4 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
