[placement] Unregister the AllocationList object

Unregister the AllocationList object because we do not need RPC and
versioning for the objects in nova.objects.resource_provider.

There are two primary changes here:

* unregistering the AllocationList class
* where objects.AllocationList is used, point directly to the
  nova.objects.resource_provider package instead

Partially-Implements: bp placement-deregister-objects
Change-Id: I554380e9b427a6c12261929989536d95086b3e0b
This commit is contained in:
Chris Dent 2017-09-08 18:08:04 +01:00
parent c5ffc0c9ce
commit 765d645abe
2 changed files with 8 additions and 7 deletions
nova
api/openstack/placement/handlers
tests/functional/api/openstack/placement

@ -25,6 +25,7 @@ from nova.api.openstack.placement import wsgi_wrapper
from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import resource_provider as rp_obj
LOG = logging.getLogger(__name__)
@ -165,7 +166,7 @@ def list_for_consumer(req):
# NOTE(cdent): There is no way for a 404 to be returned here,
# only an empty result. We do not have a way to validate a
# consumer id.
allocations = objects.AllocationList.get_all_by_consumer_id(
allocations = rp_obj.AllocationList.get_all_by_consumer_id(
context, consumer_id)
allocations_json = jsonutils.dumps(
@ -199,7 +200,7 @@ def list_for_resource_provider(req):
_("Resource provider '%(rp_uuid)s' not found: %(error)s") %
{'rp_uuid': uuid, 'error': exc})
allocations = objects.AllocationList.get_all_by_resource_provider_uuid(
allocations = rp_obj.AllocationList.get_all_by_resource_provider_uuid(
context, uuid)
allocations_json = jsonutils.dumps(
@ -242,7 +243,7 @@ def _set_allocations(req, schema):
used=resources[resource_class])
allocation_objects.append(allocation)
allocations = objects.AllocationList(
allocations = rp_obj.AllocationList(
context,
objects=allocation_objects,
project_id=data.get('project_id'),
@ -292,7 +293,7 @@ def delete_allocations(req):
context = req.environ['placement.context']
consumer_uuid = util.wsgi_path_item(req.environ, 'consumer_uuid')
allocations = objects.AllocationList.get_all_by_consumer_id(
allocations = rp_obj.AllocationList.get_all_by_consumer_id(
context, consumer_uuid)
if allocations:
try:

@ -138,7 +138,7 @@ class AllocationFixture(APIFixture):
resource_class='DISK_GB',
consumer_id=consumer_id,
used=500)
alloc_list = objects.AllocationList(
alloc_list = rp_obj.AllocationList(
self.context,
objects=[alloc1, alloc2],
project_id=project_id,
@ -166,7 +166,7 @@ class AllocationFixture(APIFixture):
resource_class='VCPU',
consumer_id=consumer_id,
used=4)
alloc_list = objects.AllocationList(
alloc_list = rp_obj.AllocationList(
self.context,
objects=[alloc1, alloc2],
project_id=project_id,
@ -187,7 +187,7 @@ class AllocationFixture(APIFixture):
resource_class='VCPU',
consumer_id=consumer_id,
used=1)
alloc_list = objects.AllocationList(
alloc_list = rp_obj.AllocationList(
self.context,
objects=[alloc1, alloc2],
project_id=project_id,