← Back to team overview

curtin-dev team mailing list archive

[Merge] ~mwhudson/curtin:raid-min-levels into curtin:master

 

Michael Hudson-Doyle has proposed merging ~mwhudson/curtin:raid-min-levels into curtin:master.

Commit message:
mdadm: RAID levels 5 and 10 can both be created with 2 devices

RAID5 with 2 devices is a bit strange but it's not really curtin's place
to check this IMO.

RAID10 with 2 is not that strange though, perhaps linux "RAID10" should
have been called something else so it doesn't get confused with
"RAID1+0" so much, which is really something else.


Requested reviews:
  curtin developers (curtin-dev)

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

I guess I should add a vmtest to verify my assertion that the RAIDs described can, in fact, be created.
-- 
Your team curtin developers is requested to review the proposed merge of ~mwhudson/curtin:raid-min-levels into curtin:master.
diff --git a/curtin/block/mdadm.py b/curtin/block/mdadm.py
index a6ac970..7bdde02 100644
--- a/curtin/block/mdadm.py
+++ b/curtin/block/mdadm.py
@@ -529,11 +529,9 @@ def md_raidlevel_short(raidlevel):
 def md_minimum_devices(raidlevel):
     ''' return the minimum number of devices for a given raid level '''
     rl = md_raidlevel_short(raidlevel)
-    if rl in [0, 1, 'linear', 'stripe', 'container']:
+    if rl in [0, 1, 'linear', 'stripe', 'container', 5, 10]:
         return 2
-    if rl in [5]:
-        return 3
-    if rl in [6, 10]:
+    if rl == 6:
         return 4
 
     return -1
diff --git a/tests/unittests/test_block_mdadm.py b/tests/unittests/test_block_mdadm.py
index b04cf82..6e375d4 100644
--- a/tests/unittests/test_block_mdadm.py
+++ b/tests/unittests/test_block_mdadm.py
@@ -800,9 +800,8 @@ class TestBlockMdadmMdHelpers(CiTestCase):
 
     def test_md_minimum_devices(self):
         min_to_rl = {
-            2: [0, 1, 'linear', 'stripe'],
-            3: [5],
-            4: [6, 10],
+            2: [0, 1, 'linear', 'stripe', 5, 10],
+            4: [6],
         }
 
         for rl in [0, 1, 5, 6, 10, 'linear', 'stripe']:

Follow ups