From 8f6bf4f9dd3f3e27e0c0cf0fab06601a9904f2f7 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 27 Mar 2019 17:30:48 +0100 Subject: Allocation API: backfilling allocations This feature addresses the case of moving the already deployed nodes under the allocation API. Change-Id: I29d0bd3663e0d1b27727a700c0f0e0fb6ceac1d9 Story: #2005014 Task: #29491 --- ironic/tests/unit/api/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ironic/tests/unit/api/utils.py') diff --git a/ironic/tests/unit/api/utils.py b/ironic/tests/unit/api/utils.py index 7addd2e8d..30444d00a 100644 --- a/ironic/tests/unit/api/utils.py +++ b/ironic/tests/unit/api/utils.py @@ -189,12 +189,16 @@ def post_get_test_portgroup(**kw): _ALLOCATION_POST_FIELDS = {'resource_class', 'uuid', 'traits', - 'candidate_nodes', 'name', 'extra'} + 'candidate_nodes', 'name', 'extra', + 'node'} -def allocation_post_data(**kw): +def allocation_post_data(node=None, **kw): """Return an Allocation object without internal attributes.""" allocation = db_utils.get_test_allocation(**kw) + if node: + # This is not a database field, so it has to be handled explicitly + allocation['node'] = node return {key: value for key, value in allocation.items() if key in _ALLOCATION_POST_FIELDS} -- cgit v1.2.1