← Back to team overview

curtin-dev team mailing list archive

[Merge] ~ogayot/curtin:raid+ptable into curtin:master

 

Olivier Gayot has proposed merging ~ogayot/curtin:raid+ptable into curtin:master.

Commit message:
storage-config: parse ptable field for RAID if specified

If the probe data reports a partition table on a RAID device, we need to
include it in the resulting storage action. Otherwise, the client needs to
guess the layout of partitions, and will most likely fail to do so.

With Subiquity, the absence of the ptable field leads to the following
issues:

 * failure to detect existing ESPs on GPT
 * upon creating a new partition on the RAID, the partition table is
   automatically changed to the default type (i.e., GPT except on s390x).

LP: #2098075

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #2098075 in subiquity: "use-gap on IMSM RAID devices installs another ESP partition, despite there is one available"
  https://bugs.launchpad.net/subiquity/+bug/2098075

For more details, see:
https://code.launchpad.net/~ogayot/curtin/+git/curtin/+merge/481078
-- 
Your team curtin developers is requested to review the proposed merge of ~ogayot/curtin:raid+ptable into curtin:master.
diff --git a/curtin/storage_config.py b/curtin/storage_config.py
index 8646a2e..f4e3797 100644
--- a/curtin/storage_config.py
+++ b/curtin/storage_config.py
@@ -1138,6 +1138,13 @@ class RaidParser(ProbertParser):
             'raidlevel': raid_data.get('raidlevel'),
             }
 
+        if 'ID_PART_TABLE_TYPE' in raid_data:
+            ptype = raid_data['ID_PART_TABLE_TYPE']
+            if ptype in schemas._ptables:
+                action['ptable'] = ptype
+            else:
+                action['ptable'] = schemas._ptable_unsupported
+
         if 'MD_METADATA' in raid_data:
             action['metadata'] = raid_data["MD_METADATA"]
 
diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
index c078c54..87ad606 100644
--- a/tests/unittests/test_storage_config.py
+++ b/tests/unittests/test_storage_config.py
@@ -1153,6 +1153,7 @@ class TestExtractStorageConfig(CiTestCase):
         self.assertEqual({'id': 'raid-md1', 'type': 'raid', 'metadata': '1.2',
                           'raidlevel': 'raid1', 'name': 'md1',
                           'path': '/dev/md1',
+                          'ptable': 'gpt',
                           'devices': ['partition-vdb1', 'partition-vdc1'],
                           'spare_devices': []}, raids[0])
         self.assertEqual({

Follow ups