Change in vdsm[master]: misc: Replace assert with AssetionError

nsoffer at redhat.com nsoffer at redhat.com
Wed Oct 22 12:57:04 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: misc: Replace assert with AssetionError
......................................................................

misc: Replace assert with AssetionError

The code was wrongly assumed that asserts are always available. When
running in optimized mode, the check would be skipped, leading to
disastrous results.

The assert was correct in that this is something that should never
happen, unless someone is using the barrier incorrectly, or there is
a bug in the code.

Change-Id: I68f57e393423dc4faf58763a036220849a968e70
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/misc.py
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/34363/1

diff --git a/vdsm/storage/misc.py b/vdsm/storage/misc.py
index ab2b4fd..5abcdcb 100644
--- a/vdsm/storage/misc.py
+++ b/vdsm/storage/misc.py
@@ -696,7 +696,9 @@
 
     def exit(self):
         with self._cond:
-            assert self._busy, "Attempt to exit a barrier without entering"
+            if not self._busy:
+                raise AssertionError("Attempt to exit a barrier without "
+                                     "entering")
             self._busy = False
             self._cond.notifyAll()
 


-- 
To view, visit http://gerrit.ovirt.org/34363
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68f57e393423dc4faf58763a036220849a968e70
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list