nova/nova/tests
Matt Riedemann 6369f39244 Remove allocations before setting vm_status to SHELVED_OFFLOADED
Tempest is intermittently failing a test which does the
following:

1. Create a server.
2. Shelve offload it.
3. Unshelve it.

Tempest waits for the server status to be SHELVED_OFFLOADED
before unshelving the server, which goes through the
scheduler to pick a compute node and claim resources on it.

When shelve offloading a server, the resource allocations
for the instance and compute node it was on are cleared, which
will also delete the internal consumer record in the placement
service.

The race is that the allocations are removed during shelve
offload *after* the server status changes to SHELVED_OFFLOADED.
This leaves a window where unshelve is going through the
scheduler and gets the existing allocations for the instance,
which are non-empty and have a consumer generation. The
claim_resources method in the scheduler then uses that
consumer generation when PUTing the allocations. That PUT
fails because in between the GET and PUT of the allocations,
placement has deleted the internal consumer record. When
PUTing the new allocations with a non-null consumer generation,
placement returns a 409 conflict error because for a new
consumer it expects the "consumer_generation" parameter to be
None.

This change handles the race by simply making sure the allocations
are deleted (along with the related consumer record in placement)
*before* the instance.vm_status is changed.

Change-Id: I2a6ccaff904c1f0759d55feeeef0ec1da32c65df
Closes-Bug: #1798688
2018-12-07 17:27:16 -05:00
..
functional Merge "Revert "Add regression test for bug 1550919"" 2018-12-01 05:23:43 +00:00
live_migration/hooks Add post-test hook for testing evacuate 2018-10-25 16:15:56 -04:00
unit Remove allocations before setting vm_status to SHELVED_OFFLOADED 2018-12-07 17:27:16 -05:00
__init__.py
fixtures.py Make CellDatabases fixture reentrant 2018-10-24 13:58:10 -07:00
json_ref.py Transform instance.exists notification 2018-06-05 12:51:30 +00:00