Allow specifying target devices for software RAID

This change adds support for the physical_disks RAID parameter in
a form of device hints (same as for root device selection).

Depends-On: https://review.opendev.org/713209
Change-Id: I9751ab0f86ada41e3b668670dc112d58093b8099
Story: #2006369
Task: #36153
This commit is contained in:
Dmitry Tantsur 2020-03-17 13:28:18 +01:00
parent 9fd0aa859c
commit cc1632a82d
5 changed files with 74 additions and 3 deletions

View File

@ -143,7 +143,12 @@ are hardware dependent.
In order to trigger the setup of a Software RAID via the Ironic Python In order to trigger the setup of a Software RAID via the Ironic Python
Agent, the value of this property needs to be set to ``software``. Agent, the value of this property needs to be set to ``software``.
- ``physical_disks`` - A list of physical disks to use as read by the - ``physical_disks`` - A list of physical disks to use as read by the
RAID interface. Not supported for software RAID. RAID interface.
For software RAID ``physical_disks`` is a list of device hints in the same
format as used for :ref:`root-device-hints`. The number of provided hints
must match the expected number of backing devices (repeat the same hint if
necessary).
.. note:: .. note::
If properties from both "Backing physical disk hints" or If properties from both "Backing physical disk hints" or
@ -260,6 +265,25 @@ HDD:
] ]
} }
*Example 6*. Software RAID, limiting backing block devices to exactly two
devices with the size exceeding 100 GiB:
.. code-block:: json
{
"logical_disks": [
{
"size_gb": "MAX",
"raid_level": "0",
"controller": "software",
"physical_disks": [
{"size": "> 100"},
{"size": "> 100"}
]
}
]
}
Current RAID configuration Current RAID configuration
-------------------------- --------------------------
After target RAID configuration is applied on the bare metal node, Ironic After target RAID configuration is applied on the bare metal node, Ironic

View File

@ -57,8 +57,10 @@
"description": "Controller to use for this logical disk. If not specified, the driver will choose a suitable RAID controller on the bare metal node. Optional." "description": "Controller to use for this logical disk. If not specified, the driver will choose a suitable RAID controller on the bare metal node. Optional."
}, },
"physical_disks": { "physical_disks": {
"type": "array", "anyOf": [
"items": { "type": "string" }, {"type": "array", "items": { "type": "string" }},
{"type": "array", "items": { "type": "object" }, "minItems": 2}
],
"description": "The physical disks to use for this logical disk. If not specified, the driver will choose suitable physical disks to use. Optional." "description": "The physical disks to use for this logical disk. If not specified, the driver will choose suitable physical disks to use. Optional."
} }
}, },

View File

@ -35,6 +35,11 @@ class ValidateRaidConfigurationTestCase(base.TestCase):
raid.validate_configuration( raid.validate_configuration(
raid_config, raid_config_schema=self.schema) raid_config, raid_config_schema=self.schema)
def test_validate_configuration_okay_software(self):
raid_config = json.loads(raid_constants.RAID_SW_CONFIG_OKAY)
raid.validate_configuration(
raid_config, raid_config_schema=self.schema)
def test_validate_configuration_no_logical_disk(self): def test_validate_configuration_no_logical_disk(self):
self.assertRaises(exception.InvalidParameterValue, self.assertRaises(exception.InvalidParameterValue,
raid.validate_configuration, raid.validate_configuration,
@ -140,6 +145,13 @@ class ValidateRaidConfigurationTestCase(base.TestCase):
raid_config, raid_config,
raid_config_schema=self.schema) raid_config_schema=self.schema)
def test_validate_configuration_too_few_physical_disks(self):
raid_config = json.loads(raid_constants.RAID_CONFIG_TOO_FEW_PHY_DISKS)
self.assertRaises(exception.InvalidParameterValue,
raid.validate_configuration,
raid_config,
raid_config_schema=self.schema)
def test_validate_configuration_additional_property(self): def test_validate_configuration_additional_property(self):
raid_config = json.loads(raid_constants.RAID_CONFIG_ADDITIONAL_PROP) raid_config = json.loads(raid_constants.RAID_CONFIG_ADDITIONAL_PROP)
self.assertRaises(exception.InvalidParameterValue, self.assertRaises(exception.InvalidParameterValue,

View File

@ -36,6 +36,19 @@ RAID_CONFIG_OKAY = '''
} }
''' '''
RAID_SW_CONFIG_OKAY = '''
{
"logical_disks": [
{
"raid_level": "1",
"size_gb": 100,
"controller": "software",
"physical_disks": [{"size": ">= 50"}, {"name": "/dev/sdc"}]
}
]
}
'''
RAID_CONFIG_NO_LOGICAL_DISKS = ''' RAID_CONFIG_NO_LOGICAL_DISKS = '''
{ {
"logical_disks": [] "logical_disks": []
@ -196,6 +209,19 @@ RAID_CONFIG_INVALID_PHY_DISKS = '''
} }
''' '''
RAID_CONFIG_TOO_FEW_PHY_DISKS = '''
{
"logical_disks": [
{
"raid_level": "1",
"size_gb": 100,
"controller": "Smart Array P822 in Slot 2",
"physical_disks": [{"size": ">= 50"}]
}
]
}
'''
RAID_CONFIG_ADDITIONAL_PROP = ''' RAID_CONFIG_ADDITIONAL_PROP = '''
{ {
"logical_disks": [ "logical_disks": [

View File

@ -0,0 +1,7 @@
---
features:
- |
Target devices for software RAID can now be specified in the form of
device hints (same as for root devices) in the ``physical_disks``
parameter of a logical disk configuration. This requires
ironic-python-agent from the Ussuri release series.