[PATCH] Fix processing of --level and --device options of ks raid commands.

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

 



* We get RAID1 from ks parser, mdadm accepts only lowercase level
specifiers of this form.
* We get int device number (e.g. 0) from ks option --device (e.g. md0).
Though this might require rather changes in pykickstart, especially
when mdadm 3.0 allows creating of arbitrary device names in /dev/md.
* mdadm --create --level option is changed to comply strictly to
documentation (e.g. "--level=raid0", though "--level raid0" works too)
---
 kickstart.py                 |   11 ++++++-----
 storage/devicelibs/mdraid.py |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/kickstart.py b/kickstart.py
index 74cafe4..b21b8ea 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -680,6 +680,7 @@ class Raid(commands.raid.F9_Raid):
     def parse(self, args):
         rd = commands.raid.F9_Raid.parse(self, args)
         raidmems = []
+        devicename = "md%d" % rd.device
 
         storage = self.handler.id.storage
         devicetree = storage.devicetree
@@ -711,12 +712,12 @@ class Raid(commands.raid.F9_Raid):
         # If this specifies an existing request that we should not format,
         # quit here after setting up enough information to mount it later.
         if not rd.format:
-            if not rd.device:
+            if not devicename:
                 raise KickstartValueError, formatErrorMsg(self.lineno, msg="--noformat used without --device")
 
-            dev = devicetree.getDeviceByName(rd.device)
+            dev = devicetree.getDeviceByName(devicename)
             if not dev:
-                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting RAID device with the name \"%s\" was found." % rd.device)
+                raise KickstartValueError, formatErrorMsg(self.lineno, msg="No preexisting RAID device with the name \"%s\" was found." % devicename)
 
             dev.format.mountpoint = lvd.mountpoint
             dev.format.mountopts = lvd.fsopts
@@ -747,8 +748,8 @@ class Raid(commands.raid.F9_Raid):
         if not kwargs["format"]:
             raise KickstartValueError, formatErrorMsg(self.lineno, msg="The \"%s\" filesystem type is not supported." % type)
 
-        kwargs["name"] = rd.device
-        kwargs["level"] = rd.level
+        kwargs["name"] = devicename
+        kwargs["level"] = rd.level.lower()
         kwargs["parents"] = raidmems
         kwargs["memberDevices"] = len(raidmems)
         kwargs["totalDevices"] = kwargs["memberDevices"]+rd.spares
diff --git a/storage/devicelibs/mdraid.py b/storage/devicelibs/mdraid.py
index 7d6ace2..6cbaa68 100644
--- a/storage/devicelibs/mdraid.py
+++ b/storage/devicelibs/mdraid.py
@@ -104,7 +104,7 @@ def get_raid_max_spares(raidlevel, nummembers):
     raise ValueError, "invalid raid level %d" % raidlevel
 
 def mdcreate(device, level, disks, spares=0):
-    argv = ["--create", device, "--run", "--level", str(level)]
+    argv = ["--create", device, "--run", "--level=%s" % level]
     raid_devs = len(disks) - spares
     argv.append("--raid-devices=%d" % raid_devs)
     if spares:
-- 
1.5.4.3

_______________________________________________
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