Saggi Mizrahi has uploaded a new change for review.
Change subject: [WIP] Continue moving VM code to it's own module ......................................................................
[WIP] Continue moving VM code to it's own module
Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5 Signed-off-by: Saggi Mizrahi smizrahi@redhat.com --- M vdsm/API.py 1 file changed, 16 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/7514/1
diff --git a/vdsm/API.py b/vdsm/API.py index aab69cd..e6a1048 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -136,15 +136,18 @@ for methName in GUEST_AGENT_METHODS: self.setattr(attrName, partial(guestTrampoline, methName))
+ def _getVmObject(self): + return self._cif.vmContainer.get(self._UUID) + def _runThinMethod(self, methodName, *args, **kwargs): - v = self._cif.vmContainer.get(self._UUID) + v = self._getVmObject() if not v: return errCode['noVM']
return getattr(v, methodName)(*args, **kwargs)
def _runGuestAgentMethod(self, methodName, *args, **kwargs): - v = self._cif.vmContainer.get(self._UUID) + v = self._getVmObject() if v is None: return errCode['noVM']
@@ -163,7 +166,7 @@ """ vmParams['vmId'] = self._UUID try: - if self._cif.vmContainer.get(self._UUID) is not None: + if self._getVmObject() is not None: self.log.warning('vm %s already exists' % vmParams['vmId']) return errCode['exist']
@@ -286,7 +289,7 @@ """ Obtain statistics of the specified VM """ - v = self._cif.vmContainer.get(self._UUID) + v = self._getVmObject() if not v: return errCode['noVM'] stats = v.getStats().copy() @@ -364,7 +367,7 @@ """ params['vmId'] = self._UUID self.log.debug(params) - v = self._cif.vmContainer.get(self._UUID) + v = self._getVmObject() if v is None: return errCode['noVM']
@@ -395,7 +398,7 @@ self.log.debug('Migration create - Failed') return response
- v = self._cif.vmContainer.get(self._UUID) + v = self._getVmObject()
if not v.waitForMigrationDestinationPrepare(): return errCode['createErr'] @@ -921,12 +924,14 @@ return d else: return {'vmId': d['vmId'], 'status': d['status']} - # To improve complexity, convert 'vms' to set(vms) - vmSet = set(vmList) + + if vmList: + vms = (self._cif.vmContainer.get(vm) for vm in vmList) + else: + vms = self._cif.vmContainer.getVMs() + return {'status': doneCode, - 'vmList': [reportedStatus(v, fullStatus) - for v in self._cif.vmContainer.getVMs() - if not vmSet or v.id in vmSet]} + 'vmList': [reportedStatus(vm, fullStatus) for vm in vms]}
# Networking-related functions def setupNetworks(self, networks={}, bondings={}, options={}):
-- To view, visit http://gerrit.ovirt.org/7514 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] Continue moving VM code to it's own module ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/698/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/7514 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
Adam Litke has posted comments on this change.
Change subject: [WIP] Continue moving VM code to it's own module ......................................................................
Patch Set 1: (1 inline comment)
.................................................... Commit Message Line 4: Commit: Saggi Mizrahi smizrahi@redhat.com Line 5: CommitDate: 2012-08-27 17:43:42 -0400 Line 6: Line 7: [WIP] Continue moving VM code to it's own module Line 8: This is a completely useless message. I realize it's WIP though... SO you still have time to improve it. Line 9: Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5
-- To view, visit http://gerrit.ovirt.org/7514 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I374dae67449f65c7c55ed028bd301be8b6a01eb5 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Saggi Mizrahi smizrahi@redhat.com Gerrit-Reviewer: Adam Litke agl@us.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Saggi Mizrahi has abandoned this change.
Change subject: [WIP] Continue moving VM code to it's own module ......................................................................
Abandoned
vdsm-patches@lists.fedorahosted.org