Fix allocation bug in NUMANetworkFixture

While doing something else, I noticed a bug in the NUMANetworkFixture:
we were trying to consume two VCPU from numa0 and three from cn2; but
our second call to tb.set_allocation() was using the same consumer as
the first, so numa0 was losing its allocation.

This commit uses a new consumer for the cn2 allocation, and tweaks an
existing gabbi test to prove the fix.

Change-Id: I893b27b7a07d20ef245c6056cde0e2c5bc5f4daa
This commit is contained in:
Eric Fried 2019-08-14 13:35:38 -05:00
parent 1801671616
commit 0e199901df
2 changed files with 7 additions and 6 deletions

View File

@ -512,6 +512,8 @@ class NUMANetworkFixture(APIFixture):
# CN2
cn2 = tb.create_provider(self.context, 'cn2', aggA_uuid)
tb.add_inventory(cn2, orc.VCPU, 8)
# Get a new consumer
consumer = tb.ensure_consumer(self.context, user, proj)
tb.set_allocation(self.context, cn2, consumer, {orc.VCPU: 3})
tb.add_inventory(
cn2, orc.MEMORY_MB, 2048, min_unit=1024, step_size=128)

View File

@ -191,14 +191,13 @@ tests:
$.allocation_requests..allocations["$ENVIRON['CN2_UUID']"].resources.DISK_GB: 100
- name: no filtering for a forbidden trait that is on children in one tree and absent from the other
GET: /allocation_candidates?resources=VCPU:1&root_required=!HW_NUMA_ROOT
GET: /allocation_candidates?resources=VCPU:3&root_required=!HW_NUMA_ROOT
status: 200
response_json_paths:
# No root has HW_NUMA_ROOT, so we hit all providers of VCPU
$.allocation_requests.`len`: 3
$.allocation_requests..allocations["$ENVIRON['NUMA0_UUID']"].resources.VCPU: 1
$.allocation_requests..allocations["$ENVIRON['NUMA1_UUID']"].resources.VCPU: 1
$.allocation_requests..allocations["$ENVIRON['CN2_UUID']"].resources.VCPU: 1
# No root has HW_NUMA_ROOT, so we hit all providers of VCPU with adequate capacity
$.allocation_requests.`len`: 2
$.allocation_requests..allocations["$ENVIRON['NUMA1_UUID']"].resources.VCPU: 3
$.allocation_requests..allocations["$ENVIRON['CN2_UUID']"].resources.VCPU: 3
- name: forbidden trait on a sharing root