AllocationList.delete_all() incorrectly assumes a single consumer
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Jay Pipes |
Bug Description
AllocationList.
```
def delete_all(self):
# Allocations can only have a single consumer, so take advantage of
# that fact and do an efficient batch delete
```
the problem with the above is that it is based on an old assumption: that a list of allocations will only ever involve a single consumer. This hasn't been the case ever since we introduced the ability to do `POST /allocations` which was 1.12 or 1.13 IIRC.
The safety concern about the above is that if someone in code does this:
```
allocs = AllocationList.
allocs.delete_all()
```
they would reasonable expect all of the allocations for a provider to be deleted. However, this is not the case. Only the allocations against the "first" consumer will be deleted.
The fix is simple... check to see if there are >1 consumers in the allocation list's objects and if so, don't call _delete_
Fix proposed to branch: master /review. openstack. org/582382
Review: https:/