[PATCH] 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 adds parameters to mdcreate to specify wether to use a
bitmap or not and which metadata version to use.

It then changes MDRaidArrayDevice.create() to:
1) For /boot force metadata version to 1.0, as grub cannot handle 1.1,
   and don't use a bitmap.
2) For swap don't use a bitmap.
3) Everything else create with bitmap
---
 storage/devicelibs/mdraid.py |    7 ++++++-
 storage/devices.py           |   10 ++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py
index 985f7a4..589fb36 100644
--- a/storage/devicelibs/mdraid.py
+++ b/storage/devicelibs/mdraid.py
@@ -139,12 +139,17 @@ def mdadm(args, progress=None):
 
     raise MDRaidError(msg)
 
-def mdcreate(device, level, disks, spares=0, progress=None):
+def mdcreate(device, level, disks, spares=0, metadataVer=None, bitmap=False,
+             progress=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)
+    if metadataVer:
+        argv.append("--metadata=%s" % metadataVer)
+    if bitmap:
+        argv.append("--bitmap=internal")
     argv.extend(disks)
     
     try:
diff --git a/storage/devices.py b/storage/devices.py
index d5a43a3..f308ed5 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -2694,10 +2694,20 @@ class MDRaidArrayDevice(StorageDevice):
 
             disks = [disk.path for disk in self.devices]
             spares = len(self.devices) - self.memberDevices
+            # Figure out format specific options
+            metadata="1.1"
+            bitmap=True
+            if getattr(self.format, "mountpoint", None) == "/boot":
+                metadata="1.0"
+                bitmap=False
+            elif self.format.type == "swap":
+                bitmap=False
             mdraid.mdcreate(self.path,
                             self.level,
                             disks,
                             spares,
+                            metadataVer=metadata,
+                            bitmap=bitmap,
                             progress=w)
         except Exception:
             raise
-- 
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