[placement] Unregister the InventoryList object

Unregister the InventoryList 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 InventoryList class
* where objects.InventoryList is used, point directly to the
  nova.objects.resource_provider package instead

Partially-Implements: bp placement-deregister-objects
Change-Id: Ic11bbef4ccbf1f3df1d50837c49e8a4cbd4ba572
This commit is contained in:
Chris Dent 2017-09-08 18:54:32 +01:00
parent 52ee2b702e
commit 54313c54e9
2 changed files with 7 additions and 6 deletions
nova
api/openstack/placement/handlers
tests/functional/api/openstack/placement

@ -25,6 +25,7 @@ from nova import db
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
RESOURCE_CLASS_IDENTIFIER = "^[A-Z0-9_]+$" RESOURCE_CLASS_IDENTIFIER = "^[A-Z0-9_]+$"
BASE_INVENTORY_SCHEMA = { BASE_INVENTORY_SCHEMA = {
@ -293,7 +294,7 @@ def get_inventories(req):
_("No resource provider with uuid %(uuid)s found : %(error)s") % _("No resource provider with uuid %(uuid)s found : %(error)s") %
{'uuid': uuid, 'error': exc}) {'uuid': uuid, 'error': exc})
inventories = objects.InventoryList.get_all_by_resource_provider_uuid( inventories = rp_obj.InventoryList.get_all_by_resource_provider_uuid(
context, resource_provider.uuid) context, resource_provider.uuid)
return _send_inventories(req.response, resource_provider, inventories) return _send_inventories(req.response, resource_provider, inventories)
@ -313,7 +314,7 @@ def get_inventory(req):
resource_provider = objects.ResourceProvider.get_by_uuid( resource_provider = objects.ResourceProvider.get_by_uuid(
context, uuid) context, uuid)
inventory = objects.InventoryList.get_all_by_resource_provider_uuid( inventory = rp_obj.InventoryList.get_all_by_resource_provider_uuid(
context, resource_provider.uuid).find(resource_class) context, resource_provider.uuid).find(resource_class)
if not inventory: if not inventory:
@ -355,7 +356,7 @@ def set_inventories(req):
inventory = _make_inventory_object( inventory = _make_inventory_object(
resource_provider, res_class, **inventory_data) resource_provider, res_class, **inventory_data)
inv_list.append(inventory) inv_list.append(inventory)
inventories = objects.InventoryList(objects=inv_list) inventories = rp_obj.InventoryList(objects=inv_list)
try: try:
resource_provider.set_inventory(inventories) resource_provider.set_inventory(inventories)
@ -399,7 +400,7 @@ def delete_inventories(req):
resource_provider = objects.ResourceProvider.get_by_uuid( resource_provider = objects.ResourceProvider.get_by_uuid(
context, uuid) context, uuid)
inventories = objects.InventoryList(objects=[]) inventories = rp_obj.InventoryList(objects=[])
try: try:
resource_provider.set_inventory(inventories) resource_provider.set_inventory(inventories)

@ -260,7 +260,7 @@ class SharedStorageFixture(APIFixture):
step_size=256, step_size=256,
allocation_ratio=1.5) allocation_ratio=1.5)
ram_inv.obj_set_defaults() ram_inv.obj_set_defaults()
inv_list = objects.InventoryList(objects=[vcpu_inv, ram_inv]) inv_list = rp_obj.InventoryList(objects=[vcpu_inv, ram_inv])
cn.set_inventory(inv_list) cn.set_inventory(inv_list)
# Populate shared storage provider with DISK_GB inventory # Populate shared storage provider with DISK_GB inventory
@ -275,7 +275,7 @@ class SharedStorageFixture(APIFixture):
step_size=10, step_size=10,
allocation_ratio=1.0) allocation_ratio=1.0)
disk_inv.obj_set_defaults() disk_inv.obj_set_defaults()
inv_list = objects.InventoryList(objects=[disk_inv]) inv_list = rp_obj.InventoryList(objects=[disk_inv])
ss.set_inventory(inv_list) ss.set_inventory(inv_list)
# Mark the shared storage pool as having inventory shared among any # Mark the shared storage pool as having inventory shared among any