Browse Source

Merge "Fix CPU count returned by introspection in Ironic iDRAC driver"

changes/62/601662/1 1.5.0
Zuul 3 years ago
committed by Gerrit Code Review
parent
commit
63e193a1c5
2 changed files with 13 additions and 1 deletions
  1. +11
    -1
      dracclient/resources/inventory.py
  2. +2
    -0
      dracclient/tests/test_inventory.py

+ 11
- 1
dracclient/resources/inventory.py View File

@ -47,7 +47,7 @@ NIC_MODE = {
CPU = collections.namedtuple(
'CPU',
['id', 'cores', 'speed_mhz', 'model', 'status', 'ht_enabled',
'turbo_enabled', 'vt_enabled', 'arch64'])
'cpu_count', 'turbo_enabled', 'vt_enabled', 'arch64'])
Memory = collections.namedtuple(
'Memory',
@ -103,10 +103,20 @@ class InventoryManagement(object):
allow_missing=True)),
turbo_enabled=bool(self._get_cpu_attr(cpu, 'TurboModeEnabled',
allow_missing=True)),
cpu_count=self._get_cpu_count(
int(self._get_cpu_attr(cpu, 'NumberOfProcessorCores')),
bool(self._get_cpu_attr(cpu, 'HyperThreadingEnabled',
allow_missing=True))),
vt_enabled=bool(self._get_cpu_attr(
cpu, 'VirtualizationTechnologyEnabled', allow_missing=True)),
arch64=arch64)
def _get_cpu_count(self, cores, ht_enabled):
if ht_enabled:
return int(cores * 2)
else:
return int(cores)
def _get_cpu_attr(self, cpu, attr_name, allow_missing=False):
return utils.get_wsman_resource_attr(
cpu, uris.DCIM_CPUView, attr_name, allow_missing=allow_missing)


+ 2
- 0
dracclient/tests/test_inventory.py View File

@ -40,6 +40,7 @@ class ClientInventoryManagementTestCase(base.BaseTest):
model='Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz',
status='ok',
ht_enabled=True,
cpu_count=12,
turbo_enabled=True,
vt_enabled=True,
arch64=True)]
@ -61,6 +62,7 @@ class ClientInventoryManagementTestCase(base.BaseTest):
model='Intel(R) Xeon(R) CPU E5-2440 v2 @ 1.90GHz',
status='ok',
ht_enabled=False,
cpu_count=8,
turbo_enabled=False,
vt_enabled=False,
arch64=False)]


Loading…
Cancel
Save