<html><body>
<p><font size="2" face="sans-serif">According to bug [1], there are some possibilities that concurrent operations on keypair/security rules can exceed quota</font><br>
<font size="2" face="sans-serif">Found that we have 3 kinds of resources in quotas.py: ReservableResource/AbsoluteResource/CountableResource</font><br>
<br>
<font size="2" face="sans-serif">curious about CountableResource because it's can't be thread safe due to its logic:</font><br>
<br>
<font size="2" face="sans-serif">count = QUOTAS.count(context, 'security_group_rules', id)</font><br>
<font size="2" face="sans-serif">try:</font><br>
<font size="2" face="sans-serif"> projected = count + len(vals)</font><br>
<font size="2" face="sans-serif"> QUOTAS.limit_check(context, security_group_rules=projected)</font><br>
<br>
<font size="2" face="sans-serif">was it designed by purpose to be different to ReservableResource? If set it to ReservableResource just like RAM/CPU, what kind of side effect it might lead to ?</font><br>
<br>
<font size="2" face="sans-serif">Also, is it possible to consider a solution like 'hold a write lock in db layer, check the count of resource and raise exception if it exceed quota'? </font><br>
<br>
<font size="2" face="sans-serif">Thanks </font><br>
<br>
<br>
<font size="2" face="sans-serif">[1] <a href="https://bugs.launchpad.net/nova/+bug/1301532">https://bugs.launchpad.net/nova/+bug/1301532</a></font><br>
<br>
<font size="2" face="sans-serif">Best Regards! <br>
<br>
Kevin (Chen) Ji ¼Í ³¿<br>
<br>
Engineer, zVM Development, CSTL<br>
Notes: Chen CH Ji/China/IBM@IBMCN Internet: jichenjc@cn.ibm.com<br>
Phone: +86-10-82454158<br>
Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District, Beijing 100193, PRC </font></body></html>