Quota is decremented during instance delete in cell0 even if the instance destroy fails
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Matt Riedemann | ||
Ocata |
Fix Committed
|
High
|
Matt Riedemann |
Bug Description
This is a follow on from bug 1670627. As pointed out in comments 23 and 25, in the local delete case where there is no host and the instance is in a cell, we're decrementing quota even if the instance.destroy() operation fails.
We commit the usage decrement here:
Attempt to destroy the instance here:
And if the instance.destroy() fails, we rollback the usage decrement here:
That rollback has no effect because once we commit a reservation, it's wiped out in the quotas object:
Attempting to rollback reservations on a quotas object that has already committed reservations is a noop:
--
Unlike the 'normal' (pre-cellsv2) local delete case which does the commit after the instance is destroyed:
And we rollback (but not commit) if instance.destroy() fails because the instance is already deleted:
--
The code in _delete() is wrong because it was copied from the code in _delete_
So we have to fix both places.
I suggest that we also change the noop behavior on the Quotas object such that if we attempt a reservation commit or rollback operation on a Quotas object that does not have any reservations, it is considered a programming error rather than a noop, because that's how this bug was introduced in the first place.
Changed in nova: | |
assignee: | nobody → Matt Riedemann (mriedem) |
Related fix proposed to branch: master /review. openstack. org/452346
Review: https:/