RAID create fails if 'controller' is missing in 'target_raid_config'
RAID creation fails with KeyError if none of the 'logical_disks' in 'target_raid_config' have 'controller' parameter. Story: 2006316 Task: 36043 Change-Id: I42ee6a46c002c14c785216834558223cbf9d319b
This commit is contained in:
parent
af61985d03
commit
b304d18802
@ -784,7 +784,7 @@ class AgentDeployMixin(HeartbeatMixin):
|
||||
logical_disks = raid_config.get('logical_disks', [])
|
||||
software_raid = False
|
||||
for logical_disk in logical_disks:
|
||||
if logical_disk['controller'] == 'software':
|
||||
if logical_disk.get('controller') == 'software':
|
||||
LOG.debug('Node %s has a Software RAID configuration',
|
||||
node.uuid)
|
||||
software_raid = True
|
||||
|
@ -1063,6 +1063,32 @@ class AgentDeployMixinTest(AgentDeployMixinBaseTest):
|
||||
try_set_boot_device_mock.assert_called_once_with(
|
||||
task, boot_devices.DISK, persistent=True)
|
||||
|
||||
@mock.patch.object(deploy_utils, 'try_set_boot_device', autospec=True)
|
||||
@mock.patch.object(agent_client.AgentClient, 'install_bootloader',
|
||||
autospec=True)
|
||||
def test_configure_local_boot_on_non_software_raid(
|
||||
self, install_bootloader_mock, try_set_boot_device_mock):
|
||||
with task_manager.acquire(self.context, self.node['uuid'],
|
||||
shared=False) as task:
|
||||
task.node.driver_internal_info['is_whole_disk_image'] = False
|
||||
task.node.target_raid_config = {
|
||||
"logical_disks": [
|
||||
{
|
||||
"size_gb": 100,
|
||||
"raid_level": "1",
|
||||
},
|
||||
{
|
||||
"size_gb": 'MAX',
|
||||
"raid_level": "0",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
self.deploy.configure_local_boot(task)
|
||||
self.assertFalse(install_bootloader_mock.called)
|
||||
try_set_boot_device_mock.assert_called_once_with(
|
||||
task, boot_devices.DISK, persistent=True)
|
||||
|
||||
@mock.patch.object(deploy_utils, 'try_set_boot_device', autospec=True)
|
||||
@mock.patch.object(agent_client.AgentClient, 'install_bootloader',
|
||||
autospec=True)
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes an issue in creation of RAID if none of the 'logical_disks'
|
||||
in 'target_raid_config' have 'controller' parameter.
|
||||
See `story 2006316
|
||||
<https://storyboard.openstack.org/#!/story/2006316>`__ for details.
|
Loading…
x
Reference in New Issue
Block a user