From 916b6d02c1fde3b77d527c77c30fbde5cc89c1e7 Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Fri, 22 Apr 2022 14:54:19 +0800 Subject: [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 Change-Id: I35e0aa2a5e612e6e45c9489153dbb3ff3e500a66 --- ironic/drivers/modules/irmc/raid.py | 6 +++--- ironic/tests/unit/drivers/modules/irmc/test_raid.py | 3 ++- ...mc-change-the-way-to-get-irmc-info-in-raid-8ef5f5f60d1f534a.yaml | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/irmc-change-the-way-to-get-irmc-info-in-raid-8ef5f5f60d1f534a.yaml diff --git a/ironic/drivers/modules/irmc/raid.py b/ironic/drivers/modules/irmc/raid.py index 26737ea11..c8a5b9537 100644 --- a/ironic/drivers/modules/irmc/raid.py +++ b/ironic/drivers/modules/irmc/raid.py @@ -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) diff --git a/ironic/tests/unit/drivers/modules/irmc/test_raid.py b/ironic/tests/unit/drivers/modules/irmc/test_raid.py index 94c77db2f..eefe7ff3a 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_raid.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_raid.py @@ -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( diff --git a/releasenotes/notes/irmc-change-the-way-to-get-irmc-info-in-raid-8ef5f5f60d1f534a.yaml b/releasenotes/notes/irmc-change-the-way-to-get-irmc-info-in-raid-8ef5f5f60d1f534a.yaml new file mode 100644 index 000000000..7a07db887 --- /dev/null +++ b/releasenotes/notes/irmc-change-the-way-to-get-irmc-info-in-raid-8ef5f5f60d1f534a.yaml @@ -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. -- cgit v1.2.1