[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:
parent
c5ffc0c9ce
commit
765d645abe
nova
@ -25,6 +25,7 @@ from nova.api.openstack.placement import wsgi_wrapper
|
|||||||
from nova import exception
|
from nova import exception
|
||||||
from nova.i18n import _
|
from nova.i18n import _
|
||||||
from nova import objects
|
from nova import objects
|
||||||
|
from nova.objects import resource_provider as rp_obj
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
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,
|
# 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
|
# only an empty result. We do not have a way to validate a
|
||||||
# consumer id.
|
# consumer id.
|
||||||
allocations = objects.AllocationList.get_all_by_consumer_id(
|
allocations = rp_obj.AllocationList.get_all_by_consumer_id(
|
||||||
context, consumer_id)
|
context, consumer_id)
|
||||||
|
|
||||||
allocations_json = jsonutils.dumps(
|
allocations_json = jsonutils.dumps(
|
||||||
@ -199,7 +200,7 @@ def list_for_resource_provider(req):
|
|||||||
_("Resource provider '%(rp_uuid)s' not found: %(error)s") %
|
_("Resource provider '%(rp_uuid)s' not found: %(error)s") %
|
||||||
{'rp_uuid': uuid, 'error': exc})
|
{'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)
|
context, uuid)
|
||||||
|
|
||||||
allocations_json = jsonutils.dumps(
|
allocations_json = jsonutils.dumps(
|
||||||
@ -242,7 +243,7 @@ def _set_allocations(req, schema):
|
|||||||
used=resources[resource_class])
|
used=resources[resource_class])
|
||||||
allocation_objects.append(allocation)
|
allocation_objects.append(allocation)
|
||||||
|
|
||||||
allocations = objects.AllocationList(
|
allocations = rp_obj.AllocationList(
|
||||||
context,
|
context,
|
||||||
objects=allocation_objects,
|
objects=allocation_objects,
|
||||||
project_id=data.get('project_id'),
|
project_id=data.get('project_id'),
|
||||||
@ -292,7 +293,7 @@ def delete_allocations(req):
|
|||||||
context = req.environ['placement.context']
|
context = req.environ['placement.context']
|
||||||
consumer_uuid = util.wsgi_path_item(req.environ, 'consumer_uuid')
|
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)
|
context, consumer_uuid)
|
||||||
if allocations:
|
if allocations:
|
||||||
try:
|
try:
|
||||||
|
@ -138,7 +138,7 @@ class AllocationFixture(APIFixture):
|
|||||||
resource_class='DISK_GB',
|
resource_class='DISK_GB',
|
||||||
consumer_id=consumer_id,
|
consumer_id=consumer_id,
|
||||||
used=500)
|
used=500)
|
||||||
alloc_list = objects.AllocationList(
|
alloc_list = rp_obj.AllocationList(
|
||||||
self.context,
|
self.context,
|
||||||
objects=[alloc1, alloc2],
|
objects=[alloc1, alloc2],
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
@ -166,7 +166,7 @@ class AllocationFixture(APIFixture):
|
|||||||
resource_class='VCPU',
|
resource_class='VCPU',
|
||||||
consumer_id=consumer_id,
|
consumer_id=consumer_id,
|
||||||
used=4)
|
used=4)
|
||||||
alloc_list = objects.AllocationList(
|
alloc_list = rp_obj.AllocationList(
|
||||||
self.context,
|
self.context,
|
||||||
objects=[alloc1, alloc2],
|
objects=[alloc1, alloc2],
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
@ -187,7 +187,7 @@ class AllocationFixture(APIFixture):
|
|||||||
resource_class='VCPU',
|
resource_class='VCPU',
|
||||||
consumer_id=consumer_id,
|
consumer_id=consumer_id,
|
||||||
used=1)
|
used=1)
|
||||||
alloc_list = objects.AllocationList(
|
alloc_list = rp_obj.AllocationList(
|
||||||
self.context,
|
self.context,
|
||||||
objects=[alloc1, alloc2],
|
objects=[alloc1, alloc2],
|
||||||
project_id=project_id,
|
project_id=project_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user