Fix CPU count returned by introspection in Ironic iDRAC driver
Change-Id: Id8ff61f7f2fb2c24af64f38f6cf34e5b6d66182c
This commit is contained in:
parent
e68dacb1d6
commit
92e4ba4c2b
|
@ -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',
|
||||
|
@ -99,10 +99,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)
|
||||
|
|
|
@ -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…
Reference in New Issue