Software RAID: don't try to set local_gb to MAX

Change-Id: Ibac5d07b988438719bf414f314cbc610562e7599
This commit is contained in:
Dmitry Tantsur 2020-07-03 14:08:45 +02:00
parent 5026854e31
commit cedc4a2416
3 changed files with 20 additions and 3 deletions

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'])

View File

@ -212,7 +212,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
@ -231,7 +232,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'])
@ -267,6 +271,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)

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.