Browse Source

Merge "Software RAID: don't try to set local_gb to MAX" into stable/train

tags/13.0.5^0
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
ecd64ea2ca
3 changed files with 20 additions and 3 deletions
  1. +2
    -1
      ironic/common/raid.py
  2. +13
    -2
      ironic/tests/unit/common/test_raid.py
  3. +5
    -0
      releasenotes/notes/raid-max-c0920cc44b9779ee.yaml

+ 2
- 1
ironic/common/raid.py View File

@@ -114,7 +114,8 @@ def update_raid_info(node, raid_config):
if root_logical_disk:
# Update local_gb and root_device_hint
properties = node.properties
properties['local_gb'] = root_logical_disk['size_gb']
if root_logical_disk['size_gb'] != 'MAX':
properties['local_gb'] = root_logical_disk['size_gb']
try:
properties['root_device'] = (
root_logical_disk['root_device_hint'])


+ 13
- 2
ironic/tests/unit/common/test_raid.py View File

@@ -200,7 +200,8 @@ class RaidPublicMethodsTestCase(db_base.DbTestCase):
self.assertIn('foo', logical_disk_properties)

def _test_update_raid_info(self, current_config,
capabilities=None):
capabilities=None,
skip_local_gb=False):
node = self.node
if capabilities:
properties = node.properties
@@ -219,7 +220,10 @@ class RaidPublicMethodsTestCase(db_base.DbTestCase):
if current_config['logical_disks'][0].get('is_root_volume'):
self.assertEqual({'wwn': '600508B100'},
properties['root_device'])
self.assertEqual(100, properties['local_gb'])
if skip_local_gb:
self.assertNotIn('local_gb', properties)
else:
self.assertEqual(100, properties['local_gb'])
self.assertIn('raid_level:1', properties['capabilities'])
if capabilities:
self.assertIn(capabilities, properties['capabilities'])
@@ -255,6 +259,13 @@ class RaidPublicMethodsTestCase(db_base.DbTestCase):
self._test_update_raid_info,
current_config)

def test_update_raid_info_skip_MAX(self):
current_config = json.loads(raid_constants.CURRENT_RAID_CONFIG)
current_config['logical_disks'][0]['size_gb'] = 'MAX'
self._test_update_raid_info(current_config,
capabilities='boot_mode:bios',
skip_local_gb=True)

def test_filter_target_raid_config(self):
result = raid.filter_target_raid_config(self.node)
self.assertEqual(self.node.target_raid_config, result)


+ 5
- 0
releasenotes/notes/raid-max-c0920cc44b9779ee.yaml View File

@@ -0,0 +1,5 @@
---
fixes:
- |
No longer tries to set ``local_gb`` to ``MAX`` when building RAID with
the root disk using ``MAX`` for its size.

Loading…
Cancel
Save