Merge ~dbungert/curtin:no-wipe-ebr into curtin:master

Proposed by Dan Bungert
Status: Merged
Approved by: Dan Bungert
Approved revision: b8ca0ce9407f9d499b0c1345357c8d49ba69b1a0
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~dbungert/curtin:no-wipe-ebr
Merge into: curtin:master
Diff against target: 40 lines (+7/-5)
2 files modified
curtin/commands/block_meta_v2.py (+5/-4)
tests/integration/test_block_meta.py (+2/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Olivier Gayot Approve
Michael Hudson-Doyle Approve
Review via email: mp+430914@code.launchpad.net

Commit message

block/v2: fix wipe check for extended

As the comment in _wipe_for_action notes, we never want to wipe the
extended, so do that check first.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I guess we could also yell at the user if they do this. Hopefully subiquity doesn't?

review: Approve
Revision history for this message
Olivier Gayot (ogayot) wrote :

Thanks, LGTM!

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
index 2cb5bc4..348bf89 100644
--- a/curtin/commands/block_meta_v2.py
+++ b/curtin/commands/block_meta_v2.py
@@ -314,16 +314,17 @@ def _find_part_info(sfdisk_info, offset):
314314
315315
316def _wipe_for_action(action):316def _wipe_for_action(action):
317 # New partitions are wiped by default apart from extended partitions, where
318 # it would destroy the EBR.
319 if action.get('flag') == 'extended':
320 LOG.debug('skipping wipe of extended partition %s' % action['id'])
321 return None
317 # If a wipe action is specified, do that.322 # If a wipe action is specified, do that.
318 if 'wipe' in action:323 if 'wipe' in action:
319 return action['wipe']324 return action['wipe']
320 # Existing partitions are left alone by default.325 # Existing partitions are left alone by default.
321 if action.get('preserve', False):326 if action.get('preserve', False):
322 return None327 return None
323 # New partitions are wiped by default apart from extended partitions, where
324 # it would destroy the EBR.
325 if action.get('flag') == 'extended':
326 return None
327 return 'superblock'328 return 'superblock'
328329
329330
diff --git a/tests/integration/test_block_meta.py b/tests/integration/test_block_meta.py
index f753a39..5f7434f 100644
--- a/tests/integration/test_block_meta.py
+++ b/tests/integration/test_block_meta.py
@@ -385,7 +385,8 @@ class TestBlockMeta(IntegrationTestCase):
385 # curtin adds 1MiB to the size of the extend partition per contained385 # curtin adds 1MiB to the size of the extend partition per contained
386 # logical partition, but only in v1 mode386 # logical partition, but only in v1 mode
387 size = '97M' if version == 1 else '99M'387 size = '97M' if version == 1 else '99M'
388 config.add_part(size=size, number=1, flag='extended')388 config.add_part(size=size, number=1, flag='extended',
389 wipe='superblock')
389 config.add_part(size='10M', number=5, flag='logical')390 config.add_part(size='10M', number=5, flag='logical')
390 config.add_part(size='10M', number=6, flag='logical')391 config.add_part(size='10M', number=6, flag='logical')
391 self.run_bm(config.render())392 self.run_bm(config.render())

Subscribers

People subscribed via source and target branches