Don't JSON encode instance_info.traits for ironic
As of queens, the ironic virt driver pushes traits set on the flavor to the ironic node's instance_info during instance spawn. This list of traits is currently encoded as a JSON string, inside the JSON-encoded instance_info. We should not use this double layer of JSON encoding, as ironic expects instance_info.traits to be a list. This change removes the nested JSON encoding when setting node.instance_info.traits. Change-Id: I1f3f96f7ef310022accde67cab1ae415bbc3c292 Closes-Bug: #1748942
This commit is contained in:
parent
bfa9e2598a
commit
54713a834f
|
@ -119,7 +119,7 @@ class IronicDriverFieldsTestCase(test.NoDBTestCase):
|
|||
node = ironic_utils.get_test_node(driver='fake')
|
||||
self.flavor['extra_specs']['trait:CUSTOM_FOO'] = 'required'
|
||||
expected = [{'path': '/instance_info/traits',
|
||||
'value': '["CUSTOM_FOO"]',
|
||||
'value': ["CUSTOM_FOO"],
|
||||
'op': 'add'}]
|
||||
expected += self._expected_deploy_patch
|
||||
patch = patcher.create(node).get_deploy_patch(
|
||||
|
@ -130,7 +130,7 @@ class IronicDriverFieldsTestCase(test.NoDBTestCase):
|
|||
node = ironic_utils.get_test_node(driver='fake')
|
||||
self.flavor['extra_specs']['trait1:CUSTOM_FOO'] = 'required'
|
||||
expected = [{'path': '/instance_info/traits',
|
||||
'value': '["CUSTOM_FOO"]',
|
||||
'value': ["CUSTOM_FOO"],
|
||||
'op': 'add'}]
|
||||
expected += self._expected_deploy_patch
|
||||
patch = patcher.create(node).get_deploy_patch(
|
||||
|
|
|
@ -115,6 +115,8 @@ class GenericDriverFields(object):
|
|||
patch.append({'path': '/instance_info/capabilities',
|
||||
'op': 'add', 'value': jsonutils.dumps(capabilities)})
|
||||
if traits:
|
||||
# NOTE(mgoddard): Don't JSON encode the traits list - ironic
|
||||
# expects instance_info.traits to be a list.
|
||||
patch.append({'path': '/instance_info/traits',
|
||||
'op': 'add', 'value': jsonutils.dumps(traits)})
|
||||
'op': 'add', 'value': traits})
|
||||
return patch
|
||||
|
|
Loading…
Reference in New Issue