summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/drac/test_inspect.py
diff options
context:
space:
mode:
authordigambar <digambarpatil15@yahoo.co.in>2018-10-30 11:57:38 -0500
committerDigambar <digambarpatil15@yahoo.co.in>2018-11-02 06:36:04 +0000
commit3e1fe5f7e45c66f606b179b4c7e57a5d2bbc6e75 (patch)
tree2bdc946513023ddb73640981531e0c7444b90223 /ironic/tests/unit/drivers/modules/drac/test_inspect.py
parent7cf2d18fa5d53cc7635986616f454217d3856118 (diff)
downloadironic-3e1fe5f7e45c66f606b179b4c7e57a5d2bbc6e75.tar.gz
Fix CPU count returned by introspection in Ironic iDRAC driver
If list_cpus in dracclient, it returns below values - [CPU(id='CPU.Socket.1', cores=14, ht__enabled=True), CPU(id='CPU.Socket.2', cores=14, ht_enabled=True)] Each CPU socket has cores with hyperthreading enabled, so if we calculate the cpu per socket, we will get actual cpu count per socket, So objective of this patch to fetch actual CPU's per socket and sum it Story: #2004155 Change-Id: Ia86b0462a3e73af7a2ce0a6439286f7071f74caa
Diffstat (limited to 'ironic/tests/unit/drivers/modules/drac/test_inspect.py')
-rw-r--r--ironic/tests/unit/drivers/modules/drac/test_inspect.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/ironic/tests/unit/drivers/modules/drac/test_inspect.py b/ironic/tests/unit/drivers/modules/drac/test_inspect.py
index 2c6b25936..1d650e29f 100644
--- a/ironic/tests/unit/drivers/modules/drac/test_inspect.py
+++ b/ironic/tests/unit/drivers/modules/drac/test_inspect.py
@@ -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)