Merge ~dbungert/curtin:pmem into curtin:master

Proposed by Dan Bungert
Status: Work in progress
Proposed branch: ~dbungert/curtin:pmem
Merge into: curtin:master
Diff against target: 29 lines (+5/-2)
2 files modified
curtin/block/__init__.py (+1/-1)
tests/unittests/test_block.py (+4/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing
curtin developers Pending
Review via email: mp+427507@code.launchpad.net

Commit message

block_meta: fix for pmem kname lookup

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

I went and found the logic in the kernel that decides whether a partition gets a p and it's way simpler than what we do in curtin: https://github.com/torvalds/linux/blob/master/block/partitions/core.c#L141. We should make our logic simpler too :)

Revision history for this message
Dan Bungert (dbungert) wrote :

Unmerged commits

2706b81... by Dan Bungert

block_meta: fix for pmem kname lookup

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py
index 49b062f..8510a01 100644
--- a/curtin/block/__init__.py
+++ b/curtin/block/__init__.py
@@ -133,7 +133,7 @@ def partition_kname(disk_kname, partition_number):
133 partition_number)))133 partition_number)))
134134
135 for dev_type in ['bcache', 'nvme', 'mmcblk', 'cciss', 'mpath', 'md',135 for dev_type in ['bcache', 'nvme', 'mmcblk', 'cciss', 'mpath', 'md',
136 'loop']:136 'loop', 'pmem']:
137 if disk_kname.startswith(dev_type):137 if disk_kname.startswith(dev_type):
138 partition_number = "p%s" % partition_number138 partition_number = "p%s" % partition_number
139 break139 break
diff --git a/tests/unittests/test_block.py b/tests/unittests/test_block.py
index 7a73b69..9dff854 100644
--- a/tests/unittests/test_block.py
+++ b/tests/unittests/test_block.py
@@ -457,7 +457,10 @@ class TestBlockKnames(CiTestCase):
457 (('cciss!c0d0', 1), 'cciss!c0d0p1'),457 (('cciss!c0d0', 1), 'cciss!c0d0p1'),
458 (('dm-0', 1), 'dm-1'),458 (('dm-0', 1), 'dm-1'),
459 (('md0', 1), 'md0p1'),459 (('md0', 1), 'md0p1'),
460 (('mpath1', 2), 'mpath1p2')]460 (('mpath1', 2), 'mpath1p2'),
461 (('pmem0', 1), 'pmem0p1'),
462 ]
463
461 for ((disk_kname, part_number), part_kname) in part_knames:464 for ((disk_kname, part_number), part_kname) in part_knames:
462 self.assertEqual(part_kname,465 self.assertEqual(part_kname,
463 block.partition_kname(disk_kname, part_number))466 block.partition_kname(disk_kname, part_number))

Subscribers

People subscribed via source and target branches