← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:lp-2118578-noble-cryptsetup-header-size into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:lp-2118578-noble-cryptsetup-header-size into curtin:master.

Commit message:
DO NOT SQUASH

zfs: choose our luks header size

Choosing a luks header size allows us to protect against surprises later
if the detected luks header size changes.

LP: #2107381 LP: #2118578
(cherry picked from commit ac353a34e70c4b916d385c310ecb4f713f49e204)



Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #2081778 in curtin: "storage probe validation fails for Windows dynamic disks "Couldn't find partition entry in table""
  https://bugs.launchpad.net/curtin/+bug/2081778
  Bug #2094979 in curtin: "curtin misidentify /dev/md126p3 as a multipath device, generates unbootable grub config"
  https://bugs.launchpad.net/curtin/+bug/2094979
  Bug #2095141 in curtin: "For OEM factory reset, reset GRUB option is not generated when resetting into existing firmware RAID disk"
  https://bugs.launchpad.net/curtin/+bug/2095141
  Bug #2098075 in curtin: "use-gap on IMSM RAID devices installs another ESP partition, despite there is one available"
  https://bugs.launchpad.net/curtin/+bug/2098075
  Bug #2107381 in curtin: "zfs + encryption fails with plucky iso dated 20250415  - Requested offset is beyond real size of device /dev/zvol/rpool/keystore"
  https://bugs.launchpad.net/curtin/+bug/2107381

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/489634
-- 
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:lp-2118578-noble-cryptsetup-header-size into curtin:master.
diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
index 5032863..a65bb29 100644
--- a/curtin/commands/curthooks.py
+++ b/curtin/commands/curthooks.py
@@ -1968,6 +1968,7 @@ def uses_grub(machine):
     return True
 
 
+<<<<<<< curtin/commands/curthooks.py
 def builtin_curthooks(cfg: dict, target: str, state: dict):
     """Run the built-in curthooks
 
@@ -1976,6 +1977,9 @@ def builtin_curthooks(cfg: dict, target: str, state: dict):
     :param: state: State information obtained from environment variables. See
         load_command_environment()
     """
+=======
+def builtin_curthooks(cfg, target, state):
+>>>>>>> curtin/commands/curthooks.py
     LOG.info('Running curtin builtin curthooks')
     stack_prefix = state.get('report_stack_prefix', '')
     state_etcd = os.path.split(state['fstab'])[0]
@@ -2156,8 +2160,18 @@ def builtin_curthooks(cfg: dict, target: str, state: dict):
             reporting_enabled=True, level="INFO",
             description="configuring target system bootloader"):
 
+<<<<<<< curtin/commands/curthooks.py
         setup_boot(cfg, target, machine, stack_prefix, osfamily=osfamily,
                    variant=distro_info.variant)
+=======
+        if uses_grub(machine):
+            with events.ReportEventStack(
+                    name=stack_prefix + '/install-grub',
+                    reporting_enabled=True, level="INFO",
+                    description="installing grub to target devices"):
+                setup_grub(cfg, target, osfamily=osfamily,
+                           variant=distro_info.variant)
+>>>>>>> curtin/commands/curthooks.py
 
     # Copy information from installation media
     with events.ReportEventStack(
diff --git a/curtin/storage_config.py b/curtin/storage_config.py
index 56bcb6e..784f4ae 100644
--- a/curtin/storage_config.py
+++ b/curtin/storage_config.py
@@ -481,6 +481,25 @@ class ProbertParser(object):
             blockdev.get('DEVNAME', ''), blockdev)
 
     @staticmethod
+<<<<<<< curtin/storage_config.py
+=======
+    def detect_partition_scheme(blockdev) -> Optional[str]:
+        ''' Return either:
+             * None if the blockdev is not partitioned
+             * A type of partition table (as a string) if it is supported
+             * "unsupported" if it is not supported.
+        '''
+        if 'ID_PART_TABLE_TYPE' not in blockdev:
+            return None
+
+        ptype = blockdev['ID_PART_TABLE_TYPE']
+        if ptype not in schemas._ptables:
+            return schemas._ptable_unsupported
+
+        return ptype
+
+    @staticmethod
+>>>>>>> curtin/storage_config.py
     def looks_like_ldm_disk(blockdev) -> bool:
         """ Tell if the disk looks like a Windows dynamic disk or LDM (aka.
             Logical Disk Manager).
@@ -510,6 +529,7 @@ class ProbertParser(object):
         except KeyError:
             return False
 
+<<<<<<< curtin/storage_config.py
     @staticmethod
     def detect_partition_scheme(blockdev) -> Optional[str]:
         ''' Return either:
@@ -531,6 +551,8 @@ class ProbertParser(object):
             return schemas._ptable_unsupported
         return ptype
 
+=======
+>>>>>>> curtin/storage_config.py
     def blockdev_to_id(self, blockdev):
         """ Examine a blockdev dictionary and return a tuple of curtin
             storage type and name that can be used as a value for
@@ -816,6 +838,15 @@ class BlockdevParser(ProbertParser):
             ptable = self.detect_partition_scheme(blockdev_data)
             if ptable is not None:
                 entry['ptable'] = ptable
+<<<<<<< curtin/storage_config.py
+=======
+
+            if self.looks_like_ldm_disk(blockdev_data):
+                LOG.debug('%s: reassigning ptable property to %s because it'
+                          ' looks like a dynamic disk',
+                          entry['path'], schemas._ptable_unsupported)
+                entry['ptable'] = schemas._ptable_unsupported
+>>>>>>> curtin/storage_config.py
 
             match = re.fullmatch(r'/dev/(?P<ctrler>nvme\d+)n\d', devname)
             if match is not None:
diff --git a/tests/unittests/test_storage_config.py b/tests/unittests/test_storage_config.py
index f2c56d8..69e3156 100644
--- a/tests/unittests/test_storage_config.py
+++ b/tests/unittests/test_storage_config.py
@@ -176,6 +176,41 @@ class TestProbertParser(CiTestCase):
 
         self.assertIsNotNone(bdparser(probe_data))
 
+<<<<<<< tests/unittests/test_storage_config.py
+=======
+    def test_detect_partition_scheme__unpartitioned(self):
+        blockdev = {
+            "DEVNAME": "/dev/sda",
+            "DEVTYPE": "disk",
+        }
+        self.assertIsNone(baseparser.detect_partition_scheme(blockdev))
+
+    def test_detect_partition_scheme__gpt(self):
+        blockdev = {
+            "DEVNAME": "/dev/sda",
+            "DEVTYPE": "disk",
+            "ID_PART_TABLE_TYPE": "gpt",
+        }
+        self.assertEqual("gpt", baseparser.detect_partition_scheme(blockdev))
+
+    def test_detect_partition_scheme__dos(self):
+        blockdev = {
+            "DEVNAME": "/dev/sda",
+            "DEVTYPE": "disk",
+            "ID_PART_TABLE_TYPE": "dos",
+        }
+        self.assertEqual("dos", baseparser.detect_partition_scheme(blockdev))
+
+    def test_detect_partition_scheme__something_else(self):
+        blockdev = {
+            "DEVNAME": "/dev/sda",
+            "DEVTYPE": "disk",
+            "ID_PART_TABLE_TYPE": "foobar",
+        }
+        self.assertEqual(
+            "unsupported", baseparser.detect_partition_scheme(blockdev))
+
+>>>>>>> tests/unittests/test_storage_config.py
     def test_looks_like_ldm_disk__one_part_and_matching(self):
         blockdev = {
             "DEVNAME": "/dev/sda",
@@ -243,6 +278,7 @@ class TestProbertParser(CiTestCase):
         }
         self.assertFalse(baseparser.looks_like_ldm_disk(blockdev))
 
+<<<<<<< tests/unittests/test_storage_config.py
     def test_detect_partition_scheme__unpartitioned(self):
         blockdev = {
             "DEVNAME": "/dev/sda",
@@ -286,6 +322,8 @@ class TestProbertParser(CiTestCase):
             self.assertEqual(
                 "unsupported", baseparser.detect_partition_scheme(blockdev))
 
+=======
+>>>>>>> tests/unittests/test_storage_config.py
 
 def _get_data(datafile):
     data = util.load_file('tests/data/%s' % datafile)