[Kimchi-devel] [PATCH] Bug fix: Allow user creates multiple templates

Aline Manera alinefm at linux.vnet.ibm.com
Tue Jun 9 14:11:27 UTC 2015



On 09/06/2015 10:54, Crístian Deives wrote:
> 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.
>

OK.




More information about the Kimchi-devel mailing list