[iRMC] Change the way to get irmc-info in raid

When using the node managed by the `irmc` hardware type,
if the port number of the bmc address is manually specified,
the following error will occur when configuring raid:

```
%d format: a number is required, not str
```

Change raid to call parse_driver_info to get irmc_info,
so that irmc-port can be converted to int type to avoid this error.

Story: #2010009
Task: #45151

Signed-off-by: Zhou Hao <zhouhao@fujitsu.com>
Change-Id: I35e0aa2a5e612e6e45c9489153dbb3ff3e500a66
This commit is contained in:
Zhou Hao 2022-04-22 14:54:19 +08:00
parent 8e57495d10
commit 916b6d02c1
3 changed files with 10 additions and 4 deletions

View File

@ -81,7 +81,7 @@ def _get_raid_adapter(node):
:returns: RAID adapter dictionary, None otherwise.
:raises: IRMCOperationError on an error from python-scciclient.
"""
irmc_info = node.driver_info
irmc_info = irmc_common.parse_driver_info(node)
LOG.info('iRMC driver is gathering RAID adapter info for node %s',
node.uuid)
try:
@ -137,7 +137,7 @@ def _create_raid_adapter(node):
:raises: IRMCOperationError on an error from python-scciclient.
"""
irmc_info = node.driver_info
irmc_info = irmc_common.parse_driver_info(node)
target_raid_config = node.target_raid_config
try:
@ -164,7 +164,7 @@ def _delete_raid_adapter(node):
:raises: IRMCOperationError if SCCI failed from python-scciclient.
"""
irmc_info = node.driver_info
irmc_info = irmc_common.parse_driver_info(node)
try:
client.elcm.delete_raid_configuration(irmc_info)

View File

@ -22,6 +22,7 @@ from ironic.common import exception
from ironic.conductor import task_manager
from ironic import drivers as ironic_drivers
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules.irmc import common as irmc_common
from ironic.drivers.modules.irmc import raid
from ironic.tests.unit.drivers.modules.irmc import test_common
@ -702,7 +703,7 @@ class IRMCRaidConfigurationInternalMethodsTestCase(test_common.BaseIRMCTest):
shared=True) as task:
raid._commit_raid_config(task)
get_raid_adapter_mock.assert_called_once_with(
task.node.driver_info)
irmc_common.parse_driver_info(task.node))
update_raid_info_mock.assert_called_once_with(
task.node, task.node.raid_config)
set_async_step_flags_mock.assert_called_once_with(

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fix a bug when configuring RAID caused by not converting the port value
to int type when the node managed by the `irmc` hardware type.