From 6a34d478296e7d4b7d81adb669cc93dccfec0690 Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Sun, 11 Oct 2020 21:52:43 +0800 Subject: [PATCH] Remove root device hint after delete_configuration The root device hint is not guaranteed to be valid after raid configuration in most cases, this could cause no matching device found and fail the deployment. AgentRAID implementations can return the correct root device hint from the create_configuration. Change-Id: Iab97a16ef8ccea8186f0cc7a14b77d508804fc8d --- ironic/drivers/modules/agent.py | 3 +++ ironic/tests/unit/drivers/modules/test_agent.py | 2 ++ .../notes/raid-remove-root-hint-ec87efd18e894256.yaml | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 releasenotes/notes/raid-remove-root-hint-ec87efd18e894256.yaml diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py index 1cb380ab21..b84eb6d95a 100644 --- a/ironic/drivers/modules/agent.py +++ b/ironic/drivers/modules/agent.py @@ -808,6 +808,9 @@ class AgentRAID(base.RAIDInterface): returned from agent ramdisk on query of the status of command(s). :returns: None """ + prop = task.node.properties + prop.pop('root_device', None) + task.node.properties = prop task.node.raid_config = {} task.node.save() diff --git a/ironic/tests/unit/drivers/modules/test_agent.py b/ironic/tests/unit/drivers/modules/test_agent.py index b55d61cdd3..56c971101f 100644 --- a/ironic/tests/unit/drivers/modules/test_agent.py +++ b/ironic/tests/unit/drivers/modules/test_agent.py @@ -1952,11 +1952,13 @@ class AgentRAIDTestCase(db_base.DbTestCase): command = {'command_result': {'clean_result': 'foo'}} with task_manager.acquire(self.context, self.node.uuid) as task: task.node.raid_config = {'foo': 'bar'} + task.node.properties = {'root_device': {'wwn': 'fake wwn'}} raid_mgmt = agent.AgentRAID raid_mgmt._delete_configuration_final(task, command) self.node.refresh() self.assertEqual({}, self.node.raid_config) + self.assertEqual({}, self.node.properties) def test__delete_configuration_final_registered( self): diff --git a/releasenotes/notes/raid-remove-root-hint-ec87efd18e894256.yaml b/releasenotes/notes/raid-remove-root-hint-ec87efd18e894256.yaml new file mode 100644 index 0000000000..be68321894 --- /dev/null +++ b/releasenotes/notes/raid-remove-root-hint-ec87efd18e894256.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - | + Agent raid will remove the root device hint after the RAID configuration + is successfully deleted. +fixes: + - | + Fixes the issue that root device hint is not removed after agent raid + interface has successfully deleted RAID configuration, the previous hint + is not guranteed to be valid thus will cause a deployment failed.