eDeploy: Store all of the facts collected by edeploy in Ironic DB

We want to store the benchmark data collected by the eDeploy
ramdisk. As this data is somewhat tricky to seperate out from the
facts collected by eDeploy, and the other facts may prove useful
for other cases, this patch just stores all of the collected data.
The collected facts are stored in the extra column of the Ironic
database under the 'edeploy_facts' key. This will allow us to do
manual analysis of the benchmark data before moving the node to
the available state.

Change-Id: Iadc5d1160cea4834184375adfba3bec2bf3d3d5c
This commit is contained in:
John Trowbridge 2015-03-18 13:45:49 -04:00
parent d374bb3621
commit 25c0d2f926
2 changed files with 16 additions and 3 deletions

View File

@ -74,6 +74,7 @@ class eDeployHook(base.ProcessingHook):
node_info['bios_settings'] = var.pop('bios_settings')
node_info['hardware'] = var
node_info['edeploy_facts'] = hw_items
except Exception as excpt:
LOG.warning(_LW(
@ -124,6 +125,11 @@ class eDeployHook(base.ProcessingHook):
'path': '/properties/capabilities',
'value': utils.dict_to_capabilities(capabilities_dict)})
patches.append(
{'op': 'add',
'path': '/extra/edeploy_facts',
'value': node_info['edeploy_facts']})
if 'target_raid_configuration' in node_info:
patches.append(
{'op': 'add',

View File

@ -54,6 +54,9 @@ class TestEdeploy(test_base.NodeTest):
self.assertEqual('192.168.100.12', node_info['hardware']['ipv4'])
self.assertEqual('99:99:99:99:99:99',
node_info['interfaces']['eth0']['mac'])
self.assertEqual([('network', 'eth0', 'serial', '99:99:99:99:99:99'),
('network', 'eth0', 'ipv4', '192.168.100.12')],
node_info['edeploy_facts'])
node_patches, _ = hook.before_update(self.node, None, node_info)
self.assertEqual('/extra/configdrive_metadata',
node_patches[0]['path'])
@ -63,11 +66,15 @@ class TestEdeploy(test_base.NodeTest):
node_patches[1]['path'])
self.assertEqual('profile:hw1',
node_patches[1]['value'])
self.assertEqual('/extra/edeploy_facts',
node_patches[2]['path'])
self.assertEqual(('network', 'eth0', 'serial', '99:99:99:99:99:99'),
node_patches[2]['value'][0])
def test_hook_multiple_capabilities(self):
hook = edeploy.eDeployHook()
self.node.properties['capabilities'] = 'cat:meow,profile:robin'
node_info = {'hardware': {'profile': 'batman'}}
node_info = {'hardware': {'profile': 'batman'}, 'edeploy_facts': []}
node_patches, _ = hook.before_update(self.node, None, node_info)
self.assertIn('cat:meow', node_patches[1]['value'])
self.assertIn('profile:batman', node_patches[1]['value'])
@ -113,7 +120,7 @@ class TestEdeploy(test_base.NodeTest):
node_patches, _ = hook.before_update(self.node, None, node_info)
self.assertEqual('/extra/target_raid_configuration',
node_patches[2]['path'])
node_patches[3]['path'])
@mock.patch.object(cmdb, 'load_cmdb')
def test_bios_configuration_passed(self, mock_load_cmdb):
@ -130,4 +137,4 @@ class TestEdeploy(test_base.NodeTest):
node_patches, _ = hook.before_update(self.node, None, node_info)
self.assertEqual('/extra/bios_settings',
node_patches[2]['path'])
node_patches[3]['path'])