Not use project table for user table

`GET /resource_provider/{uuid}/allocations` API didn't
return all the allocations made by multiple users.

This was because the placement wrongly used project table
for user table. This patch fixes it with the test case.

Change-Id: I7c808dec5de1204ced0d1f1b31d8398de8c51679
Closes-Bug: #1785382
This commit is contained in:
Tetsuro Nakamura 2018-08-04 19:22:50 +09:00
parent 9cfc598acf
commit e13b765e55
2 changed files with 5 additions and 8 deletions

View File

@ -1781,7 +1781,7 @@ def _get_allocations_by_provider_id(ctx, rp_id):
allocs = sa.alias(_ALLOC_TBL, name="a")
consumers = sa.alias(_CONSUMER_TBL, name="c")
projects = sa.alias(_PROJECT_TBL, name="p")
users = sa.alias(_PROJECT_TBL, name="u")
users = sa.alias(_USER_TBL, name="u")
cols = [
allocs.c.id,
allocs.c.resource_class_id,

View File

@ -30,17 +30,14 @@ tests:
response_headers:
content-type: /application/json/
response_json_paths:
# Bug#1785382: It doesn't show all the consumers
# on the resource provider
# $.allocations.`len`: 3
$.allocations.`len`: 2
$.allocations.`len`: 3
$.allocations["$ENVIRON['CONSUMER_0']"].resources:
DISK_GB: 1000
$.allocations["$ENVIRON['CONSUMER_ID']"].resources:
VCPU: 6
# $.allocations["$ENVIRON['ALT_CONSUMER_ID']"].resources:
# VCPU: 1
# DISK_GB: 20
$.allocations["$ENVIRON['ALT_CONSUMER_ID']"].resources:
VCPU: 1
DISK_GB: 20
$.resource_provider_generation: 5
- name: fail to delete resource provider