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
This commit is contained in:
Kaifeng Wang 2020-10-11 21:52:43 +08:00
parent cde792a8c3
commit 6a34d47829
3 changed files with 15 additions and 0 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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.