[placement] attempt to put allocation to resource provide that does not host class of resource causes 500
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Chris Dent | ||
Ocata |
Fix Committed
|
Undecided
|
Chris Dent |
Bug Description
I made a typo while writing some gabbi tests and uncovered a 500 in the placement service. If you try to allocate to a resource provider that does not host that class of resource it can have a KeyError during capacity checking. given the following gabbi in microversion 1.10:
- name: create a resource provider
POST: /resource_providers
data:
name: an rp
status: 201
- name: get resource provider
GET: $LOCATION
status: 200
- name: create a resource class
PUT: /resource_
status: 201
- name: add inventory to an rp
PUT: /resource_
data:
resource_
inventories:
VCPU:
status: 200
- name: allocate some of it
PUT: /allocations/
data:
allocations:
- resource_provider:
project_id: 42a32c07-
user_id: 66cb2f29-
status: 204
when DISK_GB is checked for capacity, we get:
2017-07-15 17:41:47,224 ERROR [nova.api.
Traceback (most recent call last):
File "nova/api/
return dispatch(environ, start_response, self._map)
File "nova/api/
return handler(environ, start_response)
File "/home/
resp = self.call_func(req, *args, **self.kwargs)
File "nova/api/
super(
File "/home/
return self.func(req, *args, **kwargs)
File "nova/api/
return _find_method(f, version)(req, *args, **kwargs)
File "nova/api/
return f(req)
File "nova/api/
return _set_allocation
File "nova/api/
allocations
File "nova/objects/
self.
File "/home/
return fn(*args, **kwargs)
File "nova/objects/
before_gens = _check_
File "nova/objects/
usage = usage_map[key]
KeyError: ('14930a42-
Fix proposed to branch: master /review. openstack. org/484162
Review: https:/