[placement] demonstrate part of bug 1778591 with a gabbi test
The test creates a resource provider with a small amount of VCPU inventory. It then tries to allocate a large number VCPU via a new consumer (and thus using consumer_generation of null). This fails with a 409 because capacity is violated. Then it queries to GET allocations on that consumer, to see if consumer generation is available. It is not. The it tries to allocate a smaller amount and though it might be expected that the generation should still be null, it takes a 0 for the allocation to be accepted. Once we decide what the right behavior is here, we can fix it. Change-Id: I196834efc2cb6ece4204abbf8544c8f2621aaa36 Related-Bug: #1778591
This commit is contained in:
parent
b10e9e48a1
commit
623cd722e0
|
@ -0,0 +1,72 @@
|
|||
# Demonstrate part of bug 1778591, where when creating an allocation for
|
||||
# a new consumer will create the consumer and its generation, but if it
|
||||
# fails the subsequent request requires generation 0, not null, which is
|
||||
# not what we expect. This is made more problematic in the we cannot query
|
||||
# the generation when the consumer has no allocations.
|
||||
|
||||
|
||||
fixtures:
|
||||
- APIFixture
|
||||
|
||||
defaults:
|
||||
request_headers:
|
||||
x-auth-token: admin
|
||||
# consumer generations were added in 1.28
|
||||
openstack-api-version: placement 1.28
|
||||
content-type: application/json
|
||||
accept: application/json
|
||||
|
||||
tests:
|
||||
# create a simple resource provider with limited inventory
|
||||
|
||||
- name: create provider
|
||||
POST: /resource_providers
|
||||
data:
|
||||
name: simple
|
||||
uuid: $ENVIRON['RP_UUID']
|
||||
|
||||
- name: set inventory
|
||||
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
|
||||
data:
|
||||
resource_provider_generation: 0
|
||||
inventories:
|
||||
VCPU:
|
||||
total: 4
|
||||
|
||||
- name: fail allocations new consumer, bad capacity
|
||||
PUT: /allocations/88888888-8888-8888-8888-888888888888
|
||||
data:
|
||||
allocations:
|
||||
"$ENVIRON['RP_UUID']":
|
||||
resources:
|
||||
VCPU: 9999
|
||||
project_id: $ENVIRON['PROJECT_ID']
|
||||
user_id: $ENVIRON['USER_ID']
|
||||
consumer_generation: null
|
||||
status: 409
|
||||
response_strings:
|
||||
- The requested amount would exceed the capacity
|
||||
|
||||
- name: try to get consumer generation
|
||||
desc: when there are no allocations we can't see the generation of a consumer
|
||||
GET: /allocations/88888888-8888-8888-8888-888888888888
|
||||
response_json_paths:
|
||||
# check entire response
|
||||
$:
|
||||
allocations: {}
|
||||
|
||||
- name: retry allocations new consumer, wrong gen
|
||||
desc: consumer generation is wrong below to make test pass
|
||||
PUT: /allocations/88888888-8888-8888-8888-888888888888
|
||||
data:
|
||||
allocations:
|
||||
"$ENVIRON['RP_UUID']":
|
||||
resources:
|
||||
VCPU: 1
|
||||
project_id: $ENVIRON['PROJECT_ID']
|
||||
user_id: $ENVIRON['USER_ID']
|
||||
# The API suggests we should have null here
|
||||
# consumer_generation: null
|
||||
# but the error response says 0, so use it to make test pass
|
||||
consumer_generation: 0
|
||||
status: 204
|
Loading…
Reference in New Issue