summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankit <ankit.dhn31@gmail.com>2020-10-29 05:35:03 +0000
committerankit <ankit.dhn31@gmail.com>2021-02-03 16:33:31 +0000
commit80017a1d37a1423a721da83b06090f8151a08f0d (patch)
treecc8347aba62697183b1c8bf9209c99ea1d0e6c34
parent7d74ea0eee8f935f5b6c8406e6997d4143fce01e (diff)
downloadironic-80017a1d37a1423a721da83b06090f8151a08f0d.tar.gz
Fixes issue of redfish firmware update
Currently ilo5 based hardware does not support redfish based firmware update. This patch fixes the issue by making the change to to check whether sushy_task.messages is present. It was also not calling prepare_ramdisk() before rebooting the system to update the firmware which has been fixed in this patch. Change-Id: I9d70fed0de1829973748c06a1342d7a7af0f93d4 Story: #2008403 Task: #41339 (cherry picked from commit 2e6777d757031a5ea0e52ff0e49a6ca1f3b84316)
-rw-r--r--ironic/drivers/modules/redfish/management.py4
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py10
-rw-r--r--releasenotes/notes/fixes-ilo5-redfish-firmware-update-issue-c6dfcd71a2f659a5.yaml9
3 files changed, 21 insertions, 2 deletions
diff --git a/ironic/drivers/modules/redfish/management.py b/ironic/drivers/modules/redfish/management.py
index 276239433..c4ebd953c 100644
--- a/ironic/drivers/modules/redfish/management.py
+++ b/ironic/drivers/modules/redfish/management.py
@@ -742,6 +742,8 @@ class RedfishManagement(base.ManagementInterface):
skip_current_step=True,
polling=True)
+ deploy_opts = deploy_utils.build_agent_options(task.node)
+ task.driver.boot.prepare_ramdisk(task, deploy_opts)
manager_utils.node_power_action(task, states.REBOOT)
return deploy_utils.get_async_step_return_state(task.node)
@@ -999,7 +1001,7 @@ class RedfishManagement(base.ManagementInterface):
# Only parse the messages if the BMC did not return parsed
# messages
messages = []
- if not sushy_task.messages[0].message:
+ if sushy_task.messages and not sushy_task.messages[0].message:
sushy_task.parse_messages()
messages = [m.message for m in sushy_task.messages]
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index 98f3b75f7..f9e74d964 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -27,6 +27,7 @@ from ironic.common import states
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules import deploy_utils
+from ironic.drivers.modules.redfish import boot as redfish_boot
from ironic.drivers.modules.redfish import management as redfish_mgmt
from ironic.drivers.modules.redfish import utils as redfish_utils
from ironic.tests.unit.db import base as db_base
@@ -740,6 +741,10 @@ class RedfishManagementTestCase(db_base.DbTestCase):
response = task.driver.management.detect_vendor(task)
self.assertEqual("Fake GmbH", response)
+ @mock.patch.object(deploy_utils, 'build_agent_options',
+ spec_set=True, autospec=True)
+ @mock.patch.object(redfish_boot.RedfishVirtualMediaBoot, 'prepare_ramdisk',
+ spec_set=True, autospec=True)
@mock.patch.object(manager_utils, 'node_power_action', autospec=True)
@mock.patch.object(deploy_utils, 'get_async_step_return_state',
autospec=True)
@@ -748,7 +753,9 @@ class RedfishManagementTestCase(db_base.DbTestCase):
def test_update_firmware(self, mock_get_update_service,
mock_set_async_step_flags,
mock_get_async_step_return_state,
- mock_node_power_action):
+ mock_node_power_action, mock_prepare,
+ build_mock):
+ build_mock.return_value = {'a': 'b'}
mock_task_monitor = mock.Mock()
mock_task_monitor.task_monitor = '/task/123'
mock_update_service = mock.Mock()
@@ -1142,6 +1149,7 @@ class RedfishManagementTestCase(db_base.DbTestCase):
mock_message = mock.Mock()
mock_message.message = 'Firmware upgrade failed'
messages = mock.PropertyMock(side_effect=[[mock_message_unparsed],
+ [mock_message],
[mock_message]])
type(mock_sushy_task).messages = messages
mock_task_monitor = mock.Mock()
diff --git a/releasenotes/notes/fixes-ilo5-redfish-firmware-update-issue-c6dfcd71a2f659a5.yaml b/releasenotes/notes/fixes-ilo5-redfish-firmware-update-issue-c6dfcd71a2f659a5.yaml
new file mode 100644
index 000000000..bb114c2bc
--- /dev/null
+++ b/releasenotes/notes/fixes-ilo5-redfish-firmware-update-issue-c6dfcd71a2f659a5.yaml
@@ -0,0 +1,9 @@
+---
+fixes:
+ - |
+ Fixes redfish firmware update for ilo5 based hardware by
+ making necessary changes to check whether sushy_task.messages
+ is present, since in case of iLo task data does not contain
+ messages attribute. Also it was not calling prepare_ramdisk()
+ before rebooting the system to update the firmware which has
+ been fixed in this patch.