[PATCH 1/2] mdraid: various changes to options for new mdraid array creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As discussed on the mailinglist, mdadm will be moving to creating
version 1.1 metadata by default, and we should be creating arrays with
bitmaps (except for /boot and swap).

So this patch makes the following changes:
1) For /boot force metadata version to 1.0, as grub cannot handle 1.1,
   no bitmap.
2) For swap force metadata 1.1 (temporary until this becomes the default),
   no bitmap
3) Everything else force metadata 1.1 and create with bitmap
---
 storage/devicelibs/mdraid.py |   14 +++++++++++++-
 storage/devices.py           |    3 ++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py
index 985f7a4..f02ae91 100644
--- a/storage/devicelibs/mdraid.py
+++ b/storage/devicelibs/mdraid.py
@@ -139,12 +139,24 @@ def mdadm(args, progress=None):
 
     raise MDRaidError(msg)
 
-def mdcreate(device, level, disks, spares=0, progress=None):
+def mdcreate(device, level, disks, spares=0, progress=None, format=None):
     argv = ["--create", device, "--run", "--level=%s" % level]
     raid_devs = len(disks) - spares
     argv.append("--raid-devices=%d" % raid_devs)
     if spares:
         argv.append("--spare-devices=%d" % spares)
+    # Figure out format specific options
+    # FIXME, the --metadata=1.1 is needed because current mdadm has a default
+    # metadata format which does not support --bitmap, once this
+    # is changed the appending of --metadata=1.1 should be removed
+    if format:
+        if hasattr(format, "mountpoint") and format.mountpoint == "/boot":
+            argv.append("--metadata=1.0")
+        elif format.type != "swap":
+            argv.append("--bitmap=internal")
+            argv.append("--metadata=1.1")
+        else:
+            argv.append("--metadata=1.1")
     argv.extend(disks)
     
     try:
diff --git a/storage/devices.py b/storage/devices.py
index d5a43a3..d87dd2c 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2698,7 +2698,8 @@ class MDRaidArrayDevice(StorageDevice):
                             self.level,
                             disks,
                             spares,
-                            progress=w)
+                            progress=w,
+                            format=self.format)
         except Exception:
             raise
         else:
-- 
1.6.5.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux