/proc/mdstat can be empty or contain mostly random RAID levels. Blivet should either modrpobe all RAID kernel modules (raid0, raid1, raid456, raid10) which then populate /proc/mdstat correctly, or don't read /proc/mdstat at all.
This patch simply removes parsing of /proc/mdstat. Do we expect that someone runs Blivet on a kernel which does not support certain RAID levels? --- blivet/devicelibs/mdraid.py | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-)
diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py index 1fc5d46..98d997f 100644 --- a/blivet/devicelibs/mdraid.py +++ b/blivet/devicelibs/mdraid.py @@ -43,39 +43,7 @@ RAID4 = 4 RAID1 = 1 RAID0 = 0
-def getRaidLevels(): - mdstat_descriptors = { - RAID10: ("[RAID10]", "[raid10]"), - RAID6: ("[RAID6]", "[raid6]"), - RAID5: ("[RAID5]", "[raid5]"), - RAID4: ("[RAID4]", "[raid4]"), - RAID1: ("[RAID1]", "[raid1]"), - RAID0: ("[RAID0]", "[raid0]"), - } - avail = [] - try: - f = open("/proc/mdstat", "r") - except IOError: - pass - else: - for l in f.readlines(): - if not l.startswith("Personalities"): - continue - - lst = l.split() - - for level in mdstat_descriptors: - for d in mdstat_descriptors[level]: - if d in lst: - avail.append(level) - break - - f.close() - - avail.sort() - return avail - -raid_levels = getRaidLevels() +raid_levels = [ RAID0, RAID1, RAID4, RAID5, RAID6, RAID10 ]
raid_descriptors = {RAID10: ("raid10", "RAID10", "10", 10), RAID6: ("raid6", "RAID6", "6", 6),
On Fri, 2013-04-12 at 16:55 +0200, Jan Safranek wrote:
/proc/mdstat can be empty or contain mostly random RAID levels. Blivet should either modrpobe all RAID kernel modules (raid0, raid1, raid456, raid10) which then populate /proc/mdstat correctly, or don't read /proc/mdstat at all.
This patch simply removes parsing of /proc/mdstat. Do we expect that someone runs Blivet on a kernel which does not support certain RAID levels?
I'm comfortable with telling users not to try to make arrays using levels their system does not support.
I like this patch. Can you verify that mdadm will load the appropriate module if/when mdadm is asked to create an a new array?
On 04/19/2013 05:27 PM, David Lehman wrote:
On Fri, 2013-04-12 at 16:55 +0200, Jan Safranek wrote:
/proc/mdstat can be empty or contain mostly random RAID levels. Blivet should either modrpobe all RAID kernel modules (raid0, raid1, raid456, raid10) which then populate /proc/mdstat correctly, or don't read /proc/mdstat at all.
This patch simply removes parsing of /proc/mdstat. Do we expect that someone runs Blivet on a kernel which does not support certain RAID levels?
I'm comfortable with telling users not to try to make arrays using levels their system does not support.
I like this patch. Can you verify that mdadm will load the appropriate module if/when mdadm is asked to create an a new array?
Sure, it works as expected
$ cat /proc/mdstat Personalities : unused devices: <none>
$ lsmod | grep raid
$ mdadm -C /dev/md/mymd -l 0 -n 2 /dev/sdb1 /dev/sdb2 ...
$ cat /proc/mdstat Personalities : [raid0] md127 : active raid0 sdb2[1] sdb1[0] 192512 blocks super 1.2 512k chunks
$ lsmod | grep raid raid0 17842
$ mdadm -C /dev/md/mymd2 -l 5 -n 3 /dev/sdb5 /dev/sdb6 /dev/sdb7 ... $ cat /proc/mdstat Personalities : [raid0] [raid6] [raid5] [raid4] md126 : active raid5 sdb7[3] sdb6[1] sdb5[0] 191488 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
md127 : active raid0 sdb2[1] sdb1[0] 192512 blocks super 1.2 512k chunks
$ lsmod | grep raid raid456 82225 1 raid0 17842 1 async_raid6_recov 17160 1 raid456 async_memcpy 12722 2 raid456,async_raid6_recov async_pq 13179 2 raid456,async_raid6_recov raid6_pq 101472 2 async_pq,async_raid6_recov async_xor 12949 3 async_pq,raid456,async_raid6_recov async_tx 13293 5 async_pq,raid456,async_xor,async_memcpy,async_raid6_recov
anaconda-patches@lists.fedorahosted.org