← Back to team overview

curtin-dev team mailing list archive

[Merge] ~mwhudson/curtin:fix-raid-ptable-logic into curtin:master

 

Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:fix-raid-ptable-logic into curtin:master.

Commit message:
disk_handler: fix partitioning a new RAID

The commmit "disk_handler: check wipe field when deciding whether to
reformat raids" fixed the case of putting a partition on an existing
raid but broke the case of putting a partition on a new RAID.

I adapted a vmtest to exercise this path too.


Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/406428

oops
-- 
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:fix-raid-ptable-logic into curtin:master.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index e5cf659..aae85c6 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -592,7 +592,8 @@ def disk_handler(info, storage_config):
     if info['type'] == 'disk':
         preserve_ptable = config.value_as_boolean(info.get('preserve'))
     else:
-        preserve_ptable = not config.value_as_boolean(info.get('wipe'))
+        preserve_ptable = config.value_as_boolean(info.get('preserve')) \
+                          and not config.value_as_boolean(info.get('wipe'))
     if preserve_ptable:
         # Handle preserve flag, verifying if ptable specified in config
         if ptable and ptable != PTABLE_UNSUPPORTED:
diff --git a/examples/tests/raid-partition-to-disk.yaml b/examples/tests/raid-partition-to-disk.yaml
index 9c16c26..d3dfd29 100644
--- a/examples/tests/raid-partition-to-disk.yaml
+++ b/examples/tests/raid-partition-to-disk.yaml
@@ -49,6 +49,13 @@ storage:
       - disk-b
       - disk-c
     raidlevel: raid1
+    ptable: gpt
+
+  - type: partition
+    id: md1_part1
+    device: md1
+    number: 1
+    size: 5G
 
   - type: format
     id: id_efi_format
@@ -56,7 +63,7 @@ storage:
     fstype: fat32
   - type: format
     id: id_root_format
-    volume: md1
+    volume: md1_part1
     fstype: ext4
 
   - type: mount

Follow ups