Merge "Allow unsetting node.target_raid_config"
This commit is contained in:
commit
b893b0ed31
@ -357,7 +357,7 @@ class NodeStatesController(rest.RestController):
|
||||
|
||||
:param node_ident: the UUID or logical name of a node.
|
||||
:param target_raid_config: Desired target RAID configuration of
|
||||
the node
|
||||
the node. It may be an empty dictionary as well.
|
||||
:raises: UnsupportedDriverExtension, if the node's driver doesn't
|
||||
support RAID configuration.
|
||||
:raises: InvalidParameterValue, if validation of target raid config
|
||||
|
@ -2086,7 +2086,7 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
||||
:param context: request context.
|
||||
:param node_id: node id or uuid.
|
||||
:param target_raid_config: Dictionary containing the target RAID
|
||||
configuration.
|
||||
configuration. It may be an empty dictionary as well.
|
||||
:raises: UnsupportedDriverExtension, if the node's driver doesn't
|
||||
support RAID configuration.
|
||||
:raises: InvalidParameterValue, if validation of target raid config
|
||||
@ -2106,7 +2106,10 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
||||
if not getattr(task.driver, 'raid', None):
|
||||
raise exception.UnsupportedDriverExtension(
|
||||
driver=task.driver, extension='raid')
|
||||
task.driver.raid.validate_raid_config(task, target_raid_config)
|
||||
# Operator may try to unset node.target_raid_config. So, try to
|
||||
# validate only if it is not empty.
|
||||
if target_raid_config:
|
||||
task.driver.raid.validate_raid_config(task, target_raid_config)
|
||||
node.target_raid_config = target_raid_config
|
||||
node.save()
|
||||
|
||||
|
@ -556,7 +556,7 @@ class ConductorAPI(object):
|
||||
:param context: request context.
|
||||
:param node_id: node id or uuid.
|
||||
:param target_raid_config: Dictionary containing the target RAID
|
||||
configuration.
|
||||
configuration. It may be an empty dictionary as well.
|
||||
:param topic: RPC topic. Defaults to self.topic.
|
||||
:raises: UnsupportedDriverExtension if the node's driver doesn't
|
||||
support RAID configuration.
|
||||
|
@ -2886,6 +2886,15 @@ class RaidTestCases(_ServiceSetUpMixin, tests_db_base.DbTestCase):
|
||||
self.node.refresh()
|
||||
self.assertEqual(raid_config, self.node.target_raid_config)
|
||||
|
||||
def test_set_target_raid_config_empty(self):
|
||||
self.node.target_raid_config = {'foo': 'bar'}
|
||||
self.node.save()
|
||||
raid_config = {}
|
||||
self.service.set_target_raid_config(
|
||||
self.context, self.node.uuid, raid_config)
|
||||
self.node.refresh()
|
||||
self.assertEqual({}, self.node.target_raid_config)
|
||||
|
||||
def test_set_target_raid_config_iface_not_supported(self):
|
||||
raid_config = {'logical_disks': [{'size_gb': 100, 'raid_level': '1'}]}
|
||||
self.driver.raid = None
|
||||
|
Loading…
Reference in New Issue
Block a user