nova/nova/tests/functional/api/openstack/placement/gabbits/allocation-candidates.yaml

79 lines
3.4 KiB
YAML

# Tests of allocation candidates API
fixtures:
- SharedStorageFixture
defaults:
request_headers:
x-auth-token: admin
accept: application/json
openstack-api-version: placement 1.10
tests:
- name: list traits
GET: /traits
status: 200
response_strings:
# We at least want to make sure that this trait is supported.
- MISC_SHARES_VIA_AGGREGATE
- name: get allocation candidates before microversion
GET: /allocation_candidates?resources=VCPU:1
request_headers:
openstack-api-version: placement 1.8
status: 404
- name: get allocation candidates no resources
GET: /allocation_candidates
status: 400
response_strings:
- "'resources' is a required property"
- name: get bad resource class
GET: /allocation_candidates?resources=MCPU:99
status: 400
response_strings:
- Invalid resource class in resources parameter
- name: get allocation candidates no allocations yet
GET: /allocation_candidates?resources=VCPU:1,MEMORY_MB:1024,DISK_GB:100
status: 200
response_json_paths:
# There are 3 providers involved. 2 compute nodes, 1 shared storage
# provider
$.provider_summaries.`len`: 3
# However, there are only 2 allocation requests, one for each compute
# node that provides the VCPU/MEMORY_MB and DISK_GB provided by the
# shared storage provider
$.allocation_requests.`len`: 2
# Verify that compute node #1 only has VCPU and MEMORY_MB listed in the
# resource requests. This validates the entire resources key.
$.allocation_requests..allocations[?resource_provider.uuid="$ENVIRON['CN1_UUID']"].resources:
VCPU: 1
MEMORY_MB: 1024
# Verify that compute node #2 only has VCPU and MEMORY_MB listed in the
# resource requests
$.allocation_requests..allocations[?resource_provider.uuid="$ENVIRON['CN2_UUID']"].resources:
VCPU: 1
MEMORY_MB: 1024
# Verify that shared storage provider only has DISK_GB listed in the
# resource requests, but is listed twice
$.allocation_requests..allocations[?resource_provider.uuid="$ENVIRON['SS_UUID']"].resources[DISK_GB]: [100, 100]
# Verify that the resources listed in the provider summary for compute
# node #1 show correct capacity and usage
$.provider_summaries["$ENVIRON['CN1_UUID']"].resources[VCPU].capacity: 384 # 16.0 * 24
$.provider_summaries["$ENVIRON['CN1_UUID']"].resources[VCPU].used: 0
$.provider_summaries["$ENVIRON['CN1_UUID']"].resources[MEMORY_MB].capacity: 196608 # 1.5 * 128G
$.provider_summaries["$ENVIRON['CN1_UUID']"].resources[MEMORY_MB].used: 0
# Verify that the resources listed in the provider summary for compute
# node #2 show correct capacity and usage
$.provider_summaries["$ENVIRON['CN2_UUID']"].resources[VCPU].capacity: 384 # 16.0 * 24
$.provider_summaries["$ENVIRON['CN2_UUID']"].resources[VCPU].used: 0
$.provider_summaries["$ENVIRON['CN2_UUID']"].resources[MEMORY_MB].capacity: 196608 # 1.5 * 128G
$.provider_summaries["$ENVIRON['CN2_UUID']"].resources[MEMORY_MB].used: 0
# Verify that the resources listed in the provider summary for shared
# storage show correct capacity and usage
$.provider_summaries["$ENVIRON['SS_UUID']"].resources[DISK_GB].capacity: 1900 # 1.0 * 2000 - 100G
$.provider_summaries["$ENVIRON['SS_UUID']"].resources[DISK_GB].used: 0