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
1diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
2index 2cb5bc4..348bf89 100644
3--- a/curtin/commands/block_meta_v2.py
4+++ b/curtin/commands/block_meta_v2.py
5@@ -314,16 +314,17 @@ def _find_part_info(sfdisk_info, offset):
6
7
8 def _wipe_for_action(action):
9+ # New partitions are wiped by default apart from extended partitions, where
10+ # it would destroy the EBR.
11+ if action.get('flag') == 'extended':
12+ LOG.debug('skipping wipe of extended partition %s' % action['id'])
13+ return None
14 # If a wipe action is specified, do that.
15 if 'wipe' in action:
16 return action['wipe']
17 # Existing partitions are left alone by default.
18 if action.get('preserve', False):
19 return None
20- # New partitions are wiped by default apart from extended partitions, where
21- # it would destroy the EBR.
22- if action.get('flag') == 'extended':
23- return None
24 return 'superblock'
25
26
27diff --git a/tests/integration/test_block_meta.py b/tests/integration/test_block_meta.py
28index f753a39..5f7434f 100644
29--- a/tests/integration/test_block_meta.py
30+++ b/tests/integration/test_block_meta.py
31@@ -385,7 +385,8 @@ class TestBlockMeta(IntegrationTestCase):
32 # curtin adds 1MiB to the size of the extend partition per contained
33 # logical partition, but only in v1 mode
34 size = '97M' if version == 1 else '99M'
35- config.add_part(size=size, number=1, flag='extended')
36+ config.add_part(size=size, number=1, flag='extended',
37+ wipe='superblock')
38 config.add_part(size='10M', number=5, flag='logical')
39 config.add_part(size='10M', number=6, flag='logical')
40 self.run_bm(config.render())

Subscribers

People subscribed via source and target branches