Francesco Romani has uploaded a new change for review. Change subject: API: better integration with MOM ......................................................................
API: better integration with MOM Currently MOM is loaded inside VDSM. This allow us to use private interfaces without breaking incapsulation. Unfortunately, the communication between MOM and VDSM is inefficient due to the mismatch between the API VDSM provides and the API MOM requires. Since both are inside the same process, these inefficiences hurt VDSM perforance. This patch adds a couple of special-purposes internal APIs to improve efficiency. Thes APIs are marked as internal and not documented in the schema, so there is no compatibility constraints with the outside. Change-Id: Ib5b26dc1db6ea6a48dbbfd5cb687fadcef98466c Signed-off-by: Francesco Romani <[email protected]> --- M tests/schemaValidationTest.py M vdsm/API.py M vdsm/virt/vm.py 3 files changed, 25 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/37183/1 diff --git a/tests/schemaValidationTest.py b/tests/schemaValidationTest.py index 43e061e..98113c6 100644 --- a/tests/schemaValidationTest.py +++ b/tests/schemaValidationTest.py @@ -35,7 +35,8 @@ # verbs not used in the engine and lacking definition in schema IGNORED_CMDS = ['Image_downloadFromStream', 'Image_uploadToStream', - 'Volume_setSize', 'Volume_updateSize'] + 'Volume_setSize', 'Volume_updateSize', + 'Host_getVMListByStatus', 'VM_getStatus'] def test_verify_schema(self): apiobj = self._get_api('API') diff --git a/vdsm/API.py b/vdsm/API.py index c8d2759..9ab87b4 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -373,6 +373,14 @@ stats = hooks.after_get_vm_stats([stats])[0] return {'status': doneCode, 'statsList': [stats]} + # internal usage only (MOM) + def getStatus(self, vmId): + v = self._cif.vmContainer.get(self._UUID) + if not v: + return errCode['noVM'] + + return {'status': doneCode, 'data': v.status(internal=True)} + def hibernate(self, hibernationVolHandle): """ Hibernate a VM. @@ -1390,6 +1398,12 @@ for v in self._cif.vmContainer.values() if not vmSet or v.id in vmSet]} + # internal usage only (MOM) + def getVMListByStatus(self, status): + return {'status': doneCode, + 'vmList': [v.id for v in self._cif.vmContainer.values() + if v.lastStatus == status]} + def getExternalVMs(self, uri, username, password): """ Return information about the not-KVM virtual machines: diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index bee1098..4452ee7 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -1724,8 +1724,16 @@ pass self.saveState() - def status(self, fullStatus=True): + def status(self, fullStatus=True, internal=False): # used by API.Global.getVMList + if internal: + with self._confLock: + return { + 'uuid': self.id, + 'status': self.lastStatus, + 'name': self.conf['name'], + 'pid': self.conf['pid']} + if not fullStatus: return {'vmId': self.id, 'status': self.lastStatus} -- To view, visit http://gerrit.ovirt.org/37183 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib5b26dc1db6ea6a48dbbfd5cb687fadcef98466c 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
