Follow-up to the IntelIPMIHardware patch

Change-Id: I240c27c25f70b0a916bbed6cc4a4122c0bffd9a9
This commit is contained in:
Madhuri Kumari 2019-07-10 14:22:57 +05:30
parent a1d844e3be
commit 01a9726c04
3 changed files with 27 additions and 30 deletions

View File

@ -18,17 +18,15 @@ Intel SST-PP supports three configuration levels:
* 2 - Intel SST-PP Config 2
The following table shows the list of active cores and their base frequency at
different SST-PP config levels::
different SST-PP config levels:
+-------------+---------+-------------------+
| Config | Cores | Base Freq (GHz) |
+=============+=========+===================+
| Base | 24 | 2.4 |
+-------------+---------+-------------------+
| Config 1 | 20 | 2.5 |
+-------------+---------+-------------------+
| Config 2 | 16 | 2.7 |
+-------------+---------+-------------------+
============== ========= ===================
Config Cores Base Freq (GHz)
============== ========= ===================
Base 24 2.4
Config 1 20 2.5
Config 2 16 2.7
============== ========= ===================
This configuration is managed by the management interface ``intel-ipmitool``
for IntelIPMI hardware.
@ -95,7 +93,7 @@ A node with Intel SST-PP can be configured to use it via
* ``intel_speedselect_config``:
Hexadecimal code of Intel SST-PP configuration. Accepted values are
['0x00', '0x01', '0x02']. These values correspond to
'0x00', '0x01', '0x02'. These values correspond to
`Intel SST-PP Config Base`, `Intel SST-PP Config 1`,
`Intel SST-PP Config 2` respectively. The input value must be a string.

View File

@ -42,7 +42,7 @@ class IntelIPMIManagement(ipmitool.IPMIManagement):
socket_count = int(sockets)
if socket_count <= 0:
raise ValueError
except ValueError:
except (ValueError, TypeError):
raise exception.InvalidParameterValue(_(
"Invalid number of socket %(socket)s value specified. "
"Expected a positive integer.") % {"socket": sockets})
@ -51,8 +51,8 @@ class IntelIPMIManagement(ipmitool.IPMIManagement):
'intel_speedselect_config': {
'description': (
"Hexadecimal code of Intel SST-PP configuration provided. "
"Input value should be string. Accepted values are "
"['0x00', '0x01', '0x02']. "
"Input value should be string. Accepted values are %s."
% ', '.join(INTEL_SST_PP_CONFIG_HEXA_CODES)
),
'required': True
},
@ -70,17 +70,15 @@ class IntelIPMIManagement(ipmitool.IPMIManagement):
"for node %(node)s with socket count %(socket)s",
{"config": config, "node": task.node.uuid,
"socket": socket_count})
self._configure_intel_speed_select(task, config, socket_count)
def _configure_intel_speed_select(self, task, config, socket_count):
iss_conf = "0x2c 0x41 0x04 0x00 0x0%s %s"
for socket in range(socket_count):
hexa_code = iss_conf % (socket, config)
try:
ipmitool.send_raw(task, hexa_code)
except exception.IPMIFailure as e:
msg = ("Failed to set Intel SST-PP configuration level "
"%(cfg)s on socket number %(skt)s due to reason "
"%(exc)s." % {"cfg": config, "skt": socket, "exc": e})
LOG.exception(msg)
msg = (_("Failed to set Intel SST-PP configuration level "
"%(cfg)s on socket number %(skt)s due to "
"reason %(exc)s.") % {"cfg": config,
"skt": socket, "exc": e})
LOG.error(msg)
raise exception.IPMIFailure(message=msg)

View File

@ -64,11 +64,11 @@ class IntelIPMIManagementTestCase(base.IntelIPMITestCase):
send_raw_mock.side_effect = exception.IPMIFailure('err')
config = {"intel_speedselect_config": "0x02", "socket_count": 1}
with task_manager.acquire(self.context, self.node.uuid) as task:
e = self.assertRaises(
self.assertRaisesRegex(
exception.IPMIFailure,
"Failed to set Intel SST-PP configuration",
task.driver.management.configure_intel_speedselect,
task, **config)
self.assertIn("Failed to set Intel SST-PP configuration", str(e))
def test_configure_intel_speedselect_invalid_input(self):
config = {"intel_speedselect_config": "0", "socket_count": 1}
@ -77,10 +77,11 @@ class IntelIPMIManagementTestCase(base.IntelIPMITestCase):
exception.InvalidParameterValue,
task.driver.management.configure_intel_speedselect,
task, **config)
config = {"intel_speedselect_config": "0x00", "socket_count": -1}
with task_manager.acquire(self.context, self.node.uuid) as task:
self.assertRaises(
exception.InvalidParameterValue,
task.driver.management.configure_intel_speedselect,
task, **config)
for value in (-1, None):
config = {"intel_speedselect_config": "0x00",
"socket_count": value}
with task_manager.acquire(self.context, self.node.uuid) as task:
self.assertRaises(
exception.InvalidParameterValue,
task.driver.management.configure_intel_speedselect,
task, **config)