ironic: delete cpu_info data from get_available_resource

The 'cpu_info' field in the dict from get_available_resource
is supposed to provide information on the physical CPU model
used in the host, including arch, model, vendor, feature flags
and topology. Instead Ironic simply returns a dummy string
"baremetal cpu".

Just delete the 'cpu_info' data entirely since there is nothing
sensible that the Ironic driver can return for this field, given
its 1:M  compute<->hypervisor relationship.

The IronicHostManager was apparently looking for this string
"baremetal cpu" to distinguish Ironic compute hosts from
non-Ironic compute hosts. This is rather crazy when we have
an explicit "hypervisor_type" field available, so replace that
check.

Cleanup before Blueprint: resource-objects
Change-Id: I7cb4f74e588c18879a2a747f158049d83359ee4c
This commit is contained in:
Daniel P. Berrange
2014-10-08 15:33:32 +01:00
parent 6e31461553
commit f1bbc53206
3 changed files with 7 additions and 3 deletions

View File

@@ -104,7 +104,7 @@ class IronicHostManager(host_manager.HostManager):
def host_state_cls(self, host, node, **kwargs):
"""Factory function/property to create a new HostState."""
compute = kwargs.get('compute')
if compute and compute.get('cpu_info') == 'baremetal cpu':
if compute and compute.get('hypervisor_type') == 'ironic':
return IronicNodeState(host, node, **kwargs)
else:
return host_manager.HostState(host, node, **kwargs)

View File

@@ -108,7 +108,7 @@ class IronicHostManagerChangedNodesTestCase(test.NoDBTestCase):
@mock.patch.object(ironic_host_manager.IronicNodeState, '__init__')
def test_create_ironic_node_state(self, init_mock):
init_mock.return_value = None
compute = {'cpu_info': 'baremetal cpu'}
compute = {'hypervisor_type': 'ironic'}
host_state = self.host_manager.host_state_cls('fake-host', 'fake-node',
compute=compute)
self.assertIs(ironic_host_manager.IronicNodeState, type(host_state))

View File

@@ -254,7 +254,11 @@ class IronicDriver(virt_driver.ComputeDriver):
'hypervisor_hostname': str(node.uuid),
'hypervisor_type': self._get_hypervisor_type(),
'hypervisor_version': self._get_hypervisor_version(),
'cpu_info': 'baremetal cpu',
# The Ironic driver manages multiple hosts, so there are
# likely many different CPU models in use. As such it is
# impossible to provide any meaningful info on the CPU
# model of the "host"
'cpu_info': None,
'vcpus': vcpus,
'vcpus_used': vcpus_used,
'local_gb': local_gb,