Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/nova/objects/resource_provider.py b/nova/objects/resource_provider.py
- index 3a40021..58c7c59 100644
- --- a/nova/objects/resource_provider.py
- +++ b/nova/objects/resource_provider.py
- @@ -689,10 +689,7 @@ def _check_capacity_exceeded(conn, allocs):
- sql.and_(_RP_TBL.c.id == _INV_TBL.c.resource_provider_id,
- _INV_TBL.c.resource_class_id.in_(res_classes)))
- primary_join = sql.outerjoin(inv_join, usage,
- - sql.and_(
- - _INV_TBL.c.resource_provider_id == usage.c.resource_provider_id,
- - _INV_TBL.c.resource_class_id == usage.c.resource_class_id)
- - )
- + _INV_TBL.c.resource_provider_id == usage.c.resource_provider_id)
- cols_in_output = [
- _RP_TBL.c.id.label('resource_provider_id'),
- diff --git a/nova/tests/functional/db/test_resource_provider.py b/nova/tests/functional/db/test_resource_provider.py
- index 89bf6fb..613e302 100644
- --- a/nova/tests/functional/db/test_resource_provider.py
- +++ b/nova/tests/functional/db/test_resource_provider.py
- @@ -583,8 +583,8 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
- rp1_class = fields.ResourceClass.DISK_GB
- rp1_used = 6
- - rp2_name = uuidsentinel.rp2_name
- - rp2_uuid = uuidsentinel.rp2_uuid
- + rp2_name = uuidsentinel.rp1_name
- + rp2_uuid = uuidsentinel.rp1_uuid
- rp2_class = fields.ResourceClass.IPV4_ADDRESS
- rp2_used = 2
- @@ -593,7 +593,8 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
- rp1.create()
- rp2 = objects.ResourceProvider(
- self.context, name=rp2_name, uuid=rp2_uuid)
- - rp2.create()
- + #rp2.create()
- + rp2 = rp1
- # Two allocations, one for each resource provider.
- allocation_1 = objects.Allocation(resource_provider=rp1,
- @@ -613,21 +614,21 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
- # Add inventory for one of the two resource providers. This should also
- # fail, since rp2 has no inventory.
- - inv = objects.Inventory(resource_provider=rp1,
- + inv1 = objects.Inventory(resource_provider=rp1,
- resource_class=rp1_class,
- total=1024)
- - inv.obj_set_defaults()
- - inv_list = objects.InventoryList(objects=[inv])
- - rp1.set_inventory(inv_list)
- - self.assertRaises(exception.InvalidInventory,
- - allocation_list.create_all)
- + inv1.obj_set_defaults()
- + #inv_list = objects.InventoryList(objects=[inv])
- + #rp1.set_inventory(inv_list)
- + #self.assertRaises(exception.InvalidInventory,
- + # allocation_list.create_all)
- # Add inventory for the second resource provider
- inv = objects.Inventory(resource_provider=rp2,
- resource_class=rp2_class,
- total=255, reserved=2)
- inv.obj_set_defaults()
- - inv_list = objects.InventoryList(objects=[inv])
- + inv_list = objects.InventoryList(objects=[inv1, inv])
- rp2.set_inventory(inv_list)
- # Now the allocations will work.
- @@ -640,7 +641,7 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
- rp2_usage = objects.UsageList.get_all_by_resource_provider_uuid(
- self.context, rp2_uuid)
- self.assertEqual(rp1_used, rp1_usage[0].usage)
- - self.assertEqual(rp2_used, rp2_usage[0].usage)
- + self.assertEqual(rp2_used, rp2_usage[1].usage)
- # redo one allocation
- # TODO(cdent): This does not currently behave as expected
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement