Merge "Fix CPU count returned by introspection in Ironic iDRAC driver"
This commit is contained in:
commit
0927a21e78
@ -80,7 +80,8 @@ class DracInspect(base.InspectInterface):
|
||||
[memory.size_mb for memory in client.list_memory()])
|
||||
cpus = client.list_cpus()
|
||||
if cpus:
|
||||
properties['cpus'] = len(cpus)
|
||||
properties['cpus'] = sum(
|
||||
[self._calculate_cpus(cpu) for cpu in cpus])
|
||||
properties['cpu_arch'] = 'x86_64' if cpus[0].arch64 else 'x86'
|
||||
|
||||
virtual_disks = client.list_virtual_disks()
|
||||
@ -148,3 +149,15 @@ class DracInspect(base.InspectInterface):
|
||||
for disk in disks:
|
||||
if disk.size_mb >= min_size_required_mb:
|
||||
return disk
|
||||
|
||||
def _calculate_cpus(self, cpu):
|
||||
"""Find actual CPU count.
|
||||
|
||||
:param cpu: Pass cpu.
|
||||
|
||||
:returns: returns total cpu count.
|
||||
"""
|
||||
if cpu.ht_enabled:
|
||||
return cpu.cores * 2
|
||||
else:
|
||||
return cpu.cores
|
||||
|
@ -63,7 +63,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
|
||||
'speed': 2400,
|
||||
'model': 'Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz',
|
||||
'state': 'ok',
|
||||
'ht_enabled': True,
|
||||
'ht_enabled': False,
|
||||
'turbo_enabled': True,
|
||||
'vt_enabled': True,
|
||||
'arch64': True}]
|
||||
@ -141,7 +141,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
|
||||
expected_node_properties = {
|
||||
'memory_mb': 32768,
|
||||
'local_gb': 1116,
|
||||
'cpus': 2,
|
||||
'cpus': 18,
|
||||
'cpu_arch': 'x86_64'}
|
||||
mock_client = mock.Mock()
|
||||
mock_get_drac_client.return_value = mock_client
|
||||
@ -184,7 +184,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
|
||||
expected_node_properties = {
|
||||
'memory_mb': 32768,
|
||||
'local_gb': 279,
|
||||
'cpus': 2,
|
||||
'cpus': 18,
|
||||
'cpu_arch': 'x86_64'}
|
||||
mock_client = mock.Mock()
|
||||
mock_get_drac_client.return_value = mock_client
|
||||
@ -229,7 +229,7 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
|
||||
expected_node_properties = {
|
||||
'memory_mb': 32768,
|
||||
'local_gb': 1116,
|
||||
'cpus': 2,
|
||||
'cpus': 18,
|
||||
'cpu_arch': 'x86_64'}
|
||||
mock_client = mock.Mock()
|
||||
mock_get_drac_client.return_value = mock_client
|
||||
@ -255,3 +255,19 @@ class DracInspectionTestCase(test_utils.BaseDracTest):
|
||||
self.physical_disks)
|
||||
|
||||
self.assertEqual(285888, root_disk.size_mb)
|
||||
|
||||
def test__calculate_cpus(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
cpu = task.driver.inspect._calculate_cpus(
|
||||
self.cpus[0])
|
||||
|
||||
self.assertEqual(12, cpu)
|
||||
|
||||
def test__calculate_cpus_without_ht_enabled(self):
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=True) as task:
|
||||
cpu = task.driver.inspect._calculate_cpus(
|
||||
self.cpus[1])
|
||||
|
||||
self.assertEqual(6, cpu)
|
||||
|
7
releasenotes/notes/fix-cpu-count-8904a4e1a24456f4.yaml
Normal file
7
releasenotes/notes/fix-cpu-count-8904a4e1a24456f4.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes a bug where the number of CPU sockets was being returned by the
|
||||
``idrac`` hardware type during introspection, instead of the number of
|
||||
virtual CPUs. See bug `2004155
|
||||
<https://storyboard.openstack.org/#!/story/2004155>`_ for details.
|
Loading…
x
Reference in New Issue
Block a user