[openstack-dev] [Nova] Question about thread safe of key-pair and securtiy rules quota

Chen CH Ji jichenjc at cn.ibm.com
Thu Jul 24 06:04:16 UTC 2014


According to bug [1], there are some possibilities that concurrent
operations on keypair/security rules can exceed quota
Found that we have 3 kinds of resources in quotas.py:
ReservableResource/AbsoluteResource/CountableResource

curious about CountableResource because it's can't be thread safe due to
its logic:

count = QUOTAS.count(context, 'security_group_rules', id)
try:
            projected = count + len(vals)
            QUOTAS.limit_check(context, security_group_rules=projected)

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 ?

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'?

Thanks


[1] https://bugs.launchpad.net/nova/+bug/1301532

Best Regards!

Kevin (Chen) Ji 纪 晨

Engineer, zVM Development, CSTL
Notes: Chen CH Ji/China/IBM at IBMCN   Internet: jichenjc at cn.ibm.com
Phone: +86-10-82454158
Address: 3/F Ring Building, ZhongGuanCun Software Park, Haidian District,
Beijing 100193, PRC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140724/9a7ac74d/attachment.html>


More information about the OpenStack-dev mailing list