commit c09d98dadb6cd69e294420ba7ecea0f9b9cfcd71
Author: Matt Riedemann <email address hidden>
Date: Tue Oct 15 15:49:55 2019 -0400
Add force kwarg to delete_allocation_for_instance
This adds a force kwarg to delete_allocation_for_instance which
defaults to True because that was found to be the most common use case
by a significant margin during implementation of this patch.
In most cases, this method is called when we want to delete the
allocations because they should be gone, e.g. server delete, failed
build, or shelve offload. The alternative in these cases is the caller
could trap the conflict error and retry but we might as well just force
the delete in that case (it's cleaner).
When force=True, it will DELETE the consumer allocations rather than
GET and PUT with an empty allocations dict and the consumer generation
which can result in a 409 conflict from Placement. For example, bug
1836754 shows that in one tempest test that creates a server and then
immediately deletes it, we can hit a very tight window where the method
GETs the allocations and before it PUTs the empty allocations to remove
them, something changes which results in a conflict and the server
delete fails with a 409 error.
It's worth noting that delete_allocation_for_instance used to just
DELETE the allocations before Stein [1] when we started taking consumer
generations into account. There was also a related mailing list thread
[2].
Reviewed: https:/ /review. opendev. org/c/openstack /nova/+ /688802 /opendev. org/openstack/ nova/commit/ c09d98dadb6cd69 e294420ba7ecea0 f9b9cfcd71
Committed: https:/
Submitter: "Zuul (22348)"
Branch: master
commit c09d98dadb6cd69 e294420ba7ecea0 f9b9cfcd71
Author: Matt Riedemann <email address hidden>
Date: Tue Oct 15 15:49:55 2019 -0400
Add force kwarg to delete_ allocation_ for_instance
This adds a force kwarg to delete_ allocation_ for_instance which
defaults to True because that was found to be the most common use case
by a significant margin during implementation of this patch.
In most cases, this method is called when we want to delete the
allocations because they should be gone, e.g. server delete, failed
build, or shelve offload. The alternative in these cases is the caller
could trap the conflict error and retry but we might as well just force
the delete in that case (it's cleaner).
When force=True, it will DELETE the consumer allocations rather than
GET and PUT with an empty allocations dict and the consumer generation
which can result in a 409 conflict from Placement. For example, bug
1836754 shows that in one tempest test that creates a server and then
immediately deletes it, we can hit a very tight window where the method
GETs the allocations and before it PUTs the empty allocations to remove
them, something changes which results in a conflict and the server
delete fails with a 409 error.
It's worth noting that delete_ allocation_ for_instance used to just
DELETE the allocations before Stein [1] when we started taking consumer
generations into account. There was also a related mailing list thread
[2].
Closes-Bug: #1836754
[1] I77f34788dd7ab8 fdf60d668a4f764 52e03cf9888 lists.openstack .org/pipermail/ openstack- dev/2018- August/ 133374. html
[2] http://
Change-Id: Ife3c7a5a95c5d7 07983ab33fd2fbf c1cfb72f676