Follow up for Iba230201803ef3d33bccaaf83eb10453eea43f20

This fixes the nits found in original review.

Change-Id: I29a5a8d613e9f01f3950fdb14891f4e81877b998
Blueprint: use-nested-allocation-candidates
This commit is contained in:
Balazs Gibizer 2018-09-27 13:26:15 +02:00
parent 9abfbf14e9
commit 3dc24972a9
2 changed files with 5 additions and 4 deletions

View File

@ -2019,7 +2019,9 @@ class SchedulerReportClient(object):
consume.
:param project_id: The project_id associated with the allocations.
:param user_id: The user_id associated with the allocations.
:param consumer_generation: The current generation of the consumer
:param consumer_generation: The current generation of the consumer or
None if this the initial allocation of the
consumer
:returns: True if the allocations were created, False otherwise.
:raises: Retry if the operation should be retried due to a concurrent
resource provider update.
@ -2029,7 +2031,7 @@ class SchedulerReportClient(object):
payload = {
'allocations': {
rp_uuid: {'resources': alloc_data},
rp_uuid: {'resources': alloc_data},
},
'project_id': project_id,
'user_id': user_id,

View File

@ -298,10 +298,9 @@ class TestPutAllocations(SchedulerReportClientTestCase):
log_msg = mock_warn.call_args[0][0]
self.assertIn("Unable to submit allocation for instance", log_msg)
@mock.patch.object(report.LOG, 'warning')
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.put')
def test_put_allocations_fail_due_to_consumer_generation_conflict(
self, mock_put, mock_warn):
self, mock_put):
mock_put.return_value = fake_requests.FakeResponse(
status_code=409,
content=jsonutils.dumps(