Francesco Romani has uploaded a new change for review. Change subject: API: use modern locking around VM.destroy ......................................................................
API: use modern locking around VM.destroy cleanup a bit VM.destroy() without functional changes: - log outside the lock - use context managers for lock Change-Id: I799b3b0d3e992df988efc6ab8e9263909062db0c Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/API.py 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/42889/1 diff --git a/vdsm/API.py b/vdsm/API.py index 242783d..55eaa80 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -332,9 +332,11 @@ """ Destroy the specified VM. """ - self._cif.vmContainerLock.acquire() - self.log.info("vmContainerLock acquired by vm %s", self._UUID) - try: + self.log.debug('About to destroy VM %s (reason=%s)', + self._UUID, + 'N/A' if reason == vmexitreason.SUCCESS + else str(reason)) + with self._cif.vmContainerLock: v = self._cif.vmContainer.get(self._UUID) if not v: return errCode['noVM'] @@ -343,8 +345,6 @@ if status['status']['code'] == 0: status['status']['message'] = "Machine destroyed" return status - finally: - self._cif.vmContainerLock.release() def getMigrationStatus(self): """ -- To view, visit https://gerrit.ovirt.org/42889 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I799b3b0d3e992df988efc6ab8e9263909062db0c Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> Gerrit-Reviewer: [email protected] _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
