Advertisement
Guest User

Untitled

a guest
Sep 6th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. diff --git a/nova/objects/resource_provider.py b/nova/objects/resource_provider.py
  2. index 3a40021..58c7c59 100644
  3. --- a/nova/objects/resource_provider.py
  4. +++ b/nova/objects/resource_provider.py
  5. @@ -689,10 +689,7 @@ def _check_capacity_exceeded(conn, allocs):
  6. sql.and_(_RP_TBL.c.id == _INV_TBL.c.resource_provider_id,
  7. _INV_TBL.c.resource_class_id.in_(res_classes)))
  8. primary_join = sql.outerjoin(inv_join, usage,
  9. - sql.and_(
  10. - _INV_TBL.c.resource_provider_id == usage.c.resource_provider_id,
  11. - _INV_TBL.c.resource_class_id == usage.c.resource_class_id)
  12. - )
  13. + _INV_TBL.c.resource_provider_id == usage.c.resource_provider_id)
  14.  
  15. cols_in_output = [
  16. _RP_TBL.c.id.label('resource_provider_id'),
  17. diff --git a/nova/tests/functional/db/test_resource_provider.py b/nova/tests/functional/db/test_resource_provider.py
  18. index 89bf6fb..613e302 100644
  19. --- a/nova/tests/functional/db/test_resource_provider.py
  20. +++ b/nova/tests/functional/db/test_resource_provider.py
  21. @@ -583,8 +583,8 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
  22. rp1_class = fields.ResourceClass.DISK_GB
  23. rp1_used = 6
  24.  
  25. - rp2_name = uuidsentinel.rp2_name
  26. - rp2_uuid = uuidsentinel.rp2_uuid
  27. + rp2_name = uuidsentinel.rp1_name
  28. + rp2_uuid = uuidsentinel.rp1_uuid
  29. rp2_class = fields.ResourceClass.IPV4_ADDRESS
  30. rp2_used = 2
  31.  
  32. @@ -593,7 +593,8 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
  33. rp1.create()
  34. rp2 = objects.ResourceProvider(
  35. self.context, name=rp2_name, uuid=rp2_uuid)
  36. - rp2.create()
  37. + #rp2.create()
  38. + rp2 = rp1
  39.  
  40. # Two allocations, one for each resource provider.
  41. allocation_1 = objects.Allocation(resource_provider=rp1,
  42. @@ -613,21 +614,21 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
  43.  
  44. # Add inventory for one of the two resource providers. This should also
  45. # fail, since rp2 has no inventory.
  46. - inv = objects.Inventory(resource_provider=rp1,
  47. + inv1 = objects.Inventory(resource_provider=rp1,
  48. resource_class=rp1_class,
  49. total=1024)
  50. - inv.obj_set_defaults()
  51. - inv_list = objects.InventoryList(objects=[inv])
  52. - rp1.set_inventory(inv_list)
  53. - self.assertRaises(exception.InvalidInventory,
  54. - allocation_list.create_all)
  55. + inv1.obj_set_defaults()
  56. + #inv_list = objects.InventoryList(objects=[inv])
  57. + #rp1.set_inventory(inv_list)
  58. + #self.assertRaises(exception.InvalidInventory,
  59. + # allocation_list.create_all)
  60.  
  61. # Add inventory for the second resource provider
  62. inv = objects.Inventory(resource_provider=rp2,
  63. resource_class=rp2_class,
  64. total=255, reserved=2)
  65. inv.obj_set_defaults()
  66. - inv_list = objects.InventoryList(objects=[inv])
  67. + inv_list = objects.InventoryList(objects=[inv1, inv])
  68. rp2.set_inventory(inv_list)
  69.  
  70. # Now the allocations will work.
  71. @@ -640,7 +641,7 @@ class TestAllocationListCreateDelete(ResourceProviderBaseCase):
  72. rp2_usage = objects.UsageList.get_all_by_resource_provider_uuid(
  73. self.context, rp2_uuid)
  74. self.assertEqual(rp1_used, rp1_usage[0].usage)
  75. - self.assertEqual(rp2_used, rp2_usage[0].usage)
  76. + self.assertEqual(rp2_used, rp2_usage[1].usage)
  77.  
  78. # redo one allocation
  79. # TODO(cdent): This does not currently behave as expected
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement