duplicate quota entry for project_id/resource causes inconsisten behaviour
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
neutron |
Confirmed
|
Medium
|
Unassigned |
Bug Description
We experienced in one of our cluster an inconsisten behaviour when setting quota for a tenant (setting security_group to 3 but still returned always 2:
$ curl -g -i -X PUT http://
HTTP/1.1 200 OK
Content-Type: application/json
X-Openstack-
Date: Wed, 15 May 2019 14:13:29 GMT
Transfer-Encoding: chunked
{"quota": {"subnet": 1, "network": 1, "floatingip": 22, "l7policy": 11, "subnetpool": 0, "security_
after some research, we found there is a duplicate entry with same, project_id and resource in the quotas table:
$ SELECT project_id, resource, count(*) as qty FROM quotas GROUP BY project_id, resource HAVING count(*)> 1
-------
3e0fd3f8e9ec44
(1 row)
deleting one of duplicate entries recovered the correct behaviour. This could be caused by a race-condition or backup leftovers.
I would suggest to add a migration that adds a unique constrain to (project_id, resource), does that sound reasonable?
IMO this proposal seems reasonable. But we should also remember to check where such race can happened and handle such duplicate entry errors properly in the code.