Bug 1628236
| Summary: | duplicated entries in cinder DB quota_usages tables for the same project | ||
|---|---|---|---|
| Product: | Red Hat OpenStack | Reporter: | Dariusz Wojewódzki <dwojewod> |
| Component: | openstack-cinder | Assignee: | Cinder Bugs List <cinder-bugs> |
| Status: | ON_DEV --- | QA Contact: | Evelina Shames <eshames> |
| Severity: | medium | Docs Contact: | Kim Nylander <knylande> |
| Priority: | medium | ||
| Version: | 10.0 (Newton) | CC: | abishop, aguetta, brian.rosmaita, cinder-bugs, dhill, eharney, geguileo, gfidente, jobernar, knoha, pgrist, scohen, srevivo |
| Target Milestone: | --- | Keywords: | Triaged |
| Target Release: | --- | Flags: | knoha:
needinfo?
(geguileo) knoha: needinfo? (geguileo) |
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Dariusz Wojewódzki
2018-09-12 13:54:17 UTC
Jon, please take a look at this one. *** Bug 1653540 has been marked as a duplicate of this bug. *** After analyzing a database dump from a customer, I've come to the conclusion that the first entry we encounter in the duplicated quota_usages entry is always wrong and the second one always the one we keep on updating and using. I wrote this little code that takes care of deleting the first entry we see for each of those entries.
~~~
for p in $(mysql -D cinder -e 'select count(resource),project_id from quota_usages group by project_id,resource order by count(resource);' | awk '{ if ($1 > 1) print $2 }' | sort | uniq | grep -v project_id); do
inc=0
echo $p
while read -r line
do
if [ ! -z "$line" ]; then
inc=$(( $inc + 1 ))
if [ $(( $inc % 2 )) -eq 1 ]; then
echo $inc $line
usage_id=$( echo $line | awk '{ print $1 }' )
mysql -D cinder -e "delete from reservations where usage_id = $usage_id"
mysql -D cinder -e "delete from quota_usages where id = $usage_id"
else
echo Skipping $line
fi
else
echo "Nothing to do!"
fi
done <<< $( mysql -D cinder -e " select q.id from quota_usages as q where project_id like '$p' order by resource,id; " | grep -v id )
done
~~~
|