nova/nova
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
..
api Add missing ws seperator between words 2018-11-26 23:42:18 +00:00
cells
cmd Merge "Deprecate the nova-console service" 2018-12-05 13:05:06 +00:00
common
compute Remove allocations before setting vm_status to SHELVED_OFFLOADED 2018-12-07 17:27:16 -05:00
conductor Merge "Drop legacy live migrate allocation compat code" 2018-10-30 05:12:26 +00:00
conf Merge "Change the default values of XXX_allocation_ratio" 2018-12-06 23:44:42 +00:00
console Use nova-consoleauth only if workaround enabled 2018-10-11 18:23:02 +00:00
consoleauth Fix stacktraces with redis caching backend 2018-09-27 13:15:11 -04:00
db Update mailinglist from dev to discuss 2018-12-05 09:44:35 +08:00
hacking Add a hacking rule for deprecated assertion methods 2018-10-25 11:49:10 +09:00
image Update mailinglist from dev to discuss 2018-12-05 09:44:35 +08:00
ipv6
keymgr
locale Imported Translations from Zanata 2018-09-23 06:53:32 +00:00
network Merge "Delete NeutronLinuxBridgeInterfaceDriver" 2018-12-06 11:28:58 +00:00
notifications Transform volume.usage notification 2018-10-09 06:28:11 +00:00
objects Merge "Change the default values of XXX_allocation_ratio" 2018-12-06 23:44:42 +00:00
pci network: update pci request spec to handle trusted tags 2018-05-31 13:55:40 -04:00
policies Merge "Allow ability for non admin users to use all filters on server list." 2018-09-23 05:17:23 +00:00
privsep Make supports_direct_io work on 4096b sector size 2018-11-13 02:17:32 +00:00
scheduler SIGHUP n-cpu to clear provider tree cache 2018-11-29 15:42:08 -06:00
servicegroup Fix service list for disabled compute using MC driver 2018-08-14 14:11:22 +08:00
tests Remove allocations before setting vm_status to SHELVED_OFFLOADED 2018-12-07 17:27:16 -05:00
virt Merge "libvirt: Refactor handling of PCIe root ports" 2018-12-07 05:20:09 +00:00
vnc Deprecate the nova-xvpvncproxy service 2018-10-15 10:03:13 +01:00
volume Remove v1 check in Cinder client version lookup 2018-11-20 14:52:12 +00:00
__init__.py
availability_zones.py
baserpc.py
block_device.py Add microversion 2.67 to support volume_type 2018-10-12 02:57:58 -04:00
cache_utils.py
config.py Configure placement DB context manager for nova-manage/status 2018-09-05 10:29:48 -04:00
context.py Refactor scatter-gather utility to return exception objects 2018-10-31 15:18:07 -04:00
crypto.py Convert certificate generation to processutils. 2018-05-02 19:18:41 +10:00
debugger.py
exception.py Merge "Add compute API validation for when a volume_type is requested" 2018-10-12 05:56:48 +00:00
exception_wrapper.py Add full traceback to ExceptionPayload in versioned notifications 2018-06-19 16:46:46 +08:00
filters.py
hooks.py
i18n.py
loadables.py
manager.py conf: Remove 'db_driver' config opt 2018-03-16 17:23:16 +00:00
policy.py Simplify logic in get_enforcer 2018-04-27 15:42:28 +00:00
profiler.py
quota.py Make _instances_cores_ram_count() be smart about cells 2018-11-13 03:35:33 -05:00
rc_fields.py Add bandwidth related standard resource classes 2018-11-05 17:47:13 -05:00
rpc.py Use oslo.messaging per-call monitoring 2018-06-11 14:44:10 -07:00
safe_utils.py
service.py Move conductor wait_until_ready() delay before manager init 2018-08-31 12:50:10 -07:00
service_auth.py
test.py Remove restart_scheduler_service() method 2018-10-25 10:59:18 -04:00
utils.py Harden placement init under wsgi 2018-11-08 12:25:46 +00:00
version.py
weights.py
wsgi.py