# 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 empty resources GET: /allocation_candidates?resources= status: 400 response_strings: - Badly formed resources parameter. Expected resources query string parameter in form - 'Got: empty string.' - 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 bad limit microversion GET: /allocation_candidates?resources=VCPU:1&limit=5 request_headers: openstack-api-version: placement 1.15 status: 400 response_strings: - Invalid query string parameters - "'limit' was unexpected" - name: get bad limit type GET: /allocation_candidates?resources=VCPU:1&limit=cow request_headers: openstack-api-version: placement 1.16 status: 400 response_strings: - Invalid query string parameters - "Failed validating 'pattern'" - name: get bad limit value negative GET: /allocation_candidates?resources=VCPU:1&limit=-99 request_headers: openstack-api-version: placement 1.16 status: 400 response_strings: - Invalid query string parameters - "Failed validating 'pattern'" - name: get bad limit value zero GET: /allocation_candidates?resources=VCPU:1&limit=0 request_headers: openstack-api-version: placement 1.16 status: 400 response_strings: - Invalid query string parameters - "Failed validating 'pattern'" - 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 response_forbidden_headers: # In the default microversion in this file (1.10) the cache headers # are not preset. - cache-control - last-modified # Verify the 1.12 format of the allocation_requests sub object which # changes from a list-list to dict-ish format. - name: get allocation candidates 1.12 dictish GET: /allocation_candidates?resources=VCPU:1,MEMORY_MB:1024,DISK_GB:100 request_headers: openstack-api-version: placement 1.12 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["$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["$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["$ENVIRON['SS_UUID']"].resources[DISK_GB]: [100, 100] - name: get allocation candidates cache headers GET: /allocation_candidates?resources=VCPU:1,MEMORY_MB:1024,DISK_GB:100 request_headers: # microversion 1.15 to cause cache headers openstack-api-version: placement 1.15 response_headers: cache-control: no-cache # Does last-modified look like a legit timestamp? last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/ - name: get allocation candidates with limit GET: /allocation_candidates?resources=VCPU:1,MEMORY_MB:1024,DISK_GB:100&limit=1 status: 200 request_headers: openstack-api-version: placement 1.16 response_json_paths: $.allocation_requests.`len`: 1