/[smeserver]/rpms/anaconda/sme8/0004-Allow-creating-mounting-degraded-raid-arrays.patch
ViewVC logotype

Annotation of /rpms/anaconda/sme8/0004-Allow-creating-mounting-degraded-raid-arrays.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Wed Apr 27 14:41:40 2011 UTC (13 years, 7 months ago) by slords
Branch: MAIN
Apply SME patches

1 slords 1.1 From 77e5886033097d9e51e6a9d47f95086f902bd8ce Mon Sep 17 00:00:00 2001
2     From: Shad L. Lords <slords@mail.com>
3     Date: Mon, 19 Oct 2009 08:08:43 -0600
4     Subject: [PATCH 04/16] Allow creating/mounting degraded raid arrays
5    
6     ---
7     fsset.py | 32 ++++++++++++++++++++++++++++++--
8     raid.py | 18 ++++++++++++++----
9     2 files changed, 44 insertions(+), 6 deletions(-)
10    
11     diff --git a/fsset.py b/fsset.py
12     index 54753a0..ea9ba66 100644
13     --- a/fsset.py
14     +++ b/fsset.py
15     @@ -2466,11 +2466,20 @@ class RAIDDevice(Device):
16     self.minor)
17    
18     def raidTab (self, devPrefix='/dev'):
19     + if self.level == 1:
20     + nDisks = max(2, self.numDisks)
21     + elif self.level == 5:
22     + nDisks = max(3, self.numDisks)
23     + elif self.level == 6:
24     + nDisks = max(4, self.numDisks)
25     + else:
26     + nDisks = self.numDisks
27     +
28     entry = ""
29     entry = entry + "raiddev %s/%s\n" % (devPrefix,
30     self.device,)
31     entry = entry + "raid-level %d\n" % (self.level,)
32     - entry = entry + "nr-raid-disks %d\n" % (self.numDisks,)
33     + entry = entry + "nr-raid-disks %d\n" % (nDisks,)
34     entry = entry + "chunk-size %s\n" %(self.chunksize,)
35     entry = entry + "persistent-superblock 1\n"
36     entry = entry + "nr-spare-disks %d\n" % (self.spares,)
37     @@ -2480,6 +2489,10 @@ class RAIDDevice(Device):
38     device)
39     entry = entry + " raid-disk %d\n" % (i,)
40     i = i + 1
41     + while i < nDisks:
42     + entry = entry + " device dev/null\n"
43     + entry = entry + " failed-disk %d\n" % (i,)
44     + i = i + 1
45     i = 0
46     for device in [m.getDevice() for m in self.members[self.numDisks:]]:
47     entry = entry + " device %s/%s\n" % (devPrefix,
48     @@ -2492,6 +2505,15 @@ class RAIDDevice(Device):
49     def devify(x):
50     return "/dev/%s" %(x,)
51    
52     + if self.level == 1:
53     + nDisks = max(2, self.numDisks)
54     + elif self.level == 5:
55     + nDisks = max(3, self.numDisks)
56     + elif self.level == 6:
57     + nDisks = max(4, self.numDisks)
58     + else:
59     + nDisks = self.numDisks
60     +
61     node = "%s/%s" % (devPrefix, self.device)
62     isys.makeDevInode(self.device, node)
63    
64     @@ -2504,12 +2526,18 @@ class RAIDDevice(Device):
65     args = ["--create", "/dev/%s" %(self.device,),
66     "--run", "--chunk=%s" %(self.chunksize,),
67     "--level=%s" %(self.level,),
68     - "--raid-devices=%s" %(self.numDisks,)]
69     + "--raid-devices=%s" %(nDisks,)]
70    
71     if self.spares > 0:
72     args.append("--spare-devices=%s" %(self.spares,),)
73    
74     args.extend(memberDevs)
75     +
76     + i = 0
77     + while self.numDisks + i < nDisks:
78     + args.append("missing")
79     + i = i + 1
80     +
81     log.info("going to run: %s" %(["/usr/sbin/mdadm"] + args,))
82     iutil.execWithRedirect ("/usr/sbin/mdadm", args,
83     stderr="/dev/tty5", stdout="/dev/tty5")
84     diff --git a/raid.py b/raid.py
85     index 28829ed..aecd762 100644
86     --- a/raid.py
87     +++ b/raid.py
88     @@ -125,7 +125,17 @@ def scanForRaid(drives):
89     raidList = []
90     for key in raidSets.keys():
91     (level, totalDisks, mdMinor, devices) = raidSets[key]
92     - if len(devices) < totalDisks:
93     + if len(devices) == totalDisks - 1 and level in (1, 5, 6):
94     + log.info("missing components of raid device md%d. The "
95     + "raid device needs %d drive(s) and only %d (was/were) found. "
96     + "This raid device will be started in degraded mode.", mdMinor,
97     + totalDisks, len(devices))
98     + elif len(devices) == totalDisks - 2 and level == 6:
99     + log.info("missing components of raid device md%d. The "
100     + "raid device needs %d drive(s) and only %d (was/were) found. "
101     + "This raid device will be started in degraded mode.", mdMinor,
102     + totalDisks, len(devices))
103     + elif len(devices) < totalDisks:
104     log.warning("missing components of raid device md%d. The "
105     "raid device needs %d drive(s) and only %d (was/were) "
106     "found. This raid device will not be started.", mdMinor,
107     @@ -185,11 +195,11 @@ def get_raid_min_members(raidlevel):
108     if isRaid0(raidlevel):
109     return 2
110     elif isRaid1(raidlevel):
111     - return 2
112     + return 1
113     elif isRaid5(raidlevel):
114     - return 3
115     + return 2
116     elif isRaid6(raidlevel):
117     - return 4
118     + return 2
119     elif isRaid10(raidlevel):
120     return 2
121     else:
122     --
123     1.7.4.1
124    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed