Merge "Return the final RAID configuration from apply_configuration"
This commit is contained in:
commit
ad9c54f55c
@ -1620,7 +1620,7 @@ class GenericHardwareManager(HardwareManager):
|
|||||||
self.validate_configuration(raid_config, node)
|
self.validate_configuration(raid_config, node)
|
||||||
if delete_existing:
|
if delete_existing:
|
||||||
self.delete_configuration(node, ports)
|
self.delete_configuration(node, ports)
|
||||||
self._do_create_configuration(node, ports, raid_config)
|
return self._do_create_configuration(node, ports, raid_config)
|
||||||
|
|
||||||
def create_configuration(self, node, ports):
|
def create_configuration(self, node, ports):
|
||||||
"""Create a RAID configuration.
|
"""Create a RAID configuration.
|
||||||
|
@ -2799,6 +2799,69 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
|||||||
self.hardware.validate_configuration,
|
self.hardware.validate_configuration,
|
||||||
self.node, [])
|
self.node, [])
|
||||||
|
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'_do_create_configuration', autospec=True)
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'delete_configuration', autospec=True)
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'validate_configuration', autospec=True)
|
||||||
|
def test_apply_configuration(self, mocked_validate, mocked_delete,
|
||||||
|
mocked_create):
|
||||||
|
raid_config = {
|
||||||
|
"logical_disks": [
|
||||||
|
{
|
||||||
|
"size_gb": "10",
|
||||||
|
"raid_level": "1",
|
||||||
|
"controller": "software",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size_gb": "MAX",
|
||||||
|
"raid_level": "0",
|
||||||
|
"controller": "software",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self.hardware.apply_configuration(self.node, [], raid_config)
|
||||||
|
self.assertIs(result, mocked_create.return_value)
|
||||||
|
mocked_validate.assert_called_once_with(self.hardware, raid_config,
|
||||||
|
self.node)
|
||||||
|
mocked_delete.assert_called_once_with(self.hardware, self.node, [])
|
||||||
|
mocked_create.assert_called_once_with(self.hardware, self.node, [],
|
||||||
|
raid_config)
|
||||||
|
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'_do_create_configuration', autospec=True)
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'delete_configuration', autospec=True)
|
||||||
|
@mock.patch.object(hardware.GenericHardwareManager,
|
||||||
|
'validate_configuration', autospec=True)
|
||||||
|
def test_apply_configuration_no_delete(self, mocked_validate,
|
||||||
|
mocked_delete, mocked_create):
|
||||||
|
raid_config = {
|
||||||
|
"logical_disks": [
|
||||||
|
{
|
||||||
|
"size_gb": "10",
|
||||||
|
"raid_level": "1",
|
||||||
|
"controller": "software",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size_gb": "MAX",
|
||||||
|
"raid_level": "0",
|
||||||
|
"controller": "software",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
result = self.hardware.apply_configuration(self.node, [], raid_config,
|
||||||
|
delete_existing=False)
|
||||||
|
self.assertIs(result, mocked_create.return_value)
|
||||||
|
mocked_validate.assert_called_once_with(self.hardware, raid_config,
|
||||||
|
self.node)
|
||||||
|
self.assertFalse(mocked_delete.called)
|
||||||
|
mocked_create.assert_called_once_with(self.hardware, self.node, [],
|
||||||
|
raid_config)
|
||||||
|
|
||||||
@mock.patch.object(disk_utils, 'list_partitions', autospec=True)
|
@mock.patch.object(disk_utils, 'list_partitions', autospec=True)
|
||||||
@mock.patch.object(utils, 'execute', autospec=True)
|
@mock.patch.object(utils, 'execute', autospec=True)
|
||||||
@mock.patch.object(os.path, 'isdir', autospec=True, return_value=False)
|
@mock.patch.object(os.path, 'isdir', autospec=True, return_value=False)
|
||||||
|
6
releasenotes/notes/apply-raid-aeca7848c6320d6b.yaml
Normal file
6
releasenotes/notes/apply-raid-aeca7848c6320d6b.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
Fixes the return value of the ``apply_configuration`` deploy step: the
|
||||||
|
``agent`` RAID interface expects the final RAID configuration to be
|
||||||
|
returned.
|
Loading…
Reference in New Issue
Block a user