[Kimchi-devel] [PATCH] Bug fix: Allow user creates multiple templates
Crístian Deives
cristiandeives at gmail.com
Tue Jun 9 13:54:30 UTC 2015
On 08-06-2015 15:27, Aline Manera wrote:
> + cls.lock.acquire()
> with RollbackContext() as rollback:
> conn = libvirt.open(None)
> rollback.prependDefer(conn.close)
> @@ -67,6 +71,7 @@ class UserTests(object):
> else:
> cls.user = p.username
>
> + cls.lock.release()
> return cls.user
The function "cls.lock.release()" may not be called if an exception is
raised from inside the rollback block, and the lock will be acquired
forever. You should enclose the "with rollback" block with a "with
cls.lock" block as well, just like you did a few lines above. In that
case, the "with cls.lock" block will release the lock regardless of how
the block ends.
More information about the Kimchi-devel
mailing list