75 |
def requiredDisplayMode(self): |
def requiredDisplayMode(self): |
76 |
return 't' |
return 't' |
77 |
|
|
78 |
|
def driveIsRemovable(self, device): |
79 |
|
try: |
80 |
|
removable = bool(int(open("/sys/block/%s/removable" % device).read())) |
81 |
|
except: |
82 |
|
removable = False |
83 |
|
|
84 |
|
return removable |
85 |
|
|
86 |
def setSteps(self, dispatch): |
def setSteps(self, dispatch): |
87 |
dispatch.setStepList( |
dispatch.setStepList( |
88 |
"language", |
"language", |
118 |
"complete" |
"complete" |
119 |
) |
) |
120 |
|
|
121 |
# 'partition' can be used on the command line to force |
# 'partition' can be used on the command line to force |
122 |
# verification of partitions. useful in some cases... |
# verification of partitions. useful in some cases... |
123 |
if self.doPartition or flags.cmdline.has_key("partition"): |
if self.doPartition or flags.cmdline.has_key("partition"): |
124 |
if not self.doPartition: |
if not self.doPartition: |
133 |
|
|
134 |
alldrives = diskset.driveList() |
alldrives = diskset.driveList() |
135 |
if flags.cmdline.has_key("drives"): |
if flags.cmdline.has_key("drives"): |
136 |
drives = filter(lambda x:isys.mediaPresent(x) and x in flags.cmdline["drives"].split(","), alldrives) |
drives = filter(lambda x:isys.mediaPresent(x) and |
137 |
|
x in flags.cmdline["drives"].split(","), alldrives) |
138 |
else: |
else: |
139 |
drives = filter(lambda x:isys.mediaPresent(x) and not isys.driveUsesModule(x, ["usb-storage", "sbp2"]), alldrives) |
drives = filter(lambda x:not self.driveIsRemovable(x) and |
140 |
|
isys.mediaPresent(x) and |
141 |
|
not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
142 |
|
|
143 |
if flags.cmdline.has_key("spares"): |
if flags.cmdline.has_key("spares"): |
144 |
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
169 |
else: |
else: |
170 |
level = 1 |
level = 1 |
171 |
|
|
|
log.info("Using the following drives: %s" % drives) |
|
|
if level >= 1: |
|
|
log.info("Installing using RAID%s" % level) |
|
|
log.info("Using %s spare drives" % spares) |
|
|
else: |
|
|
log.warning("Installing without using RAID") |
|
|
|
|
|
(swapMin, swapMax) = iutil.swapSuggestion() |
|
172 |
if len(drives) >= 1: |
if len(drives) >= 1: |
173 |
|
log.info("Using the following drives: %s" % drives) |
174 |
|
if level >= 1: |
175 |
|
log.info("Installing using RAID%s" % level) |
176 |
|
log.info("Using %s spare drives" % spares) |
177 |
|
else: |
178 |
|
log.warning("Installing without using RAID") |
179 |
|
|
180 |
|
(swapMin, swapMax) = iutil.swapSuggestion() |
181 |
if level >= 1: |
if level >= 1: |
182 |
raid1 = [] |
raid1 = [] |
183 |
raid2 = [] |
raid2 = [] |
185 |
uniqueID = 100 |
uniqueID = 100 |
186 |
|
|
187 |
for drive in drives: |
for drive in drives: |
188 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
189 |
drive=[drive], size=100, primary=1, format=1) |
drive=[drive], size=100, primary=1, format=1) |
190 |
request.uniqueID = uniqueID |
request.uniqueID = uniqueID |
191 |
raid1.append(uniqueID) |
raid1.append(uniqueID) |
192 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
193 |
|
|
194 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
195 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
196 |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
197 |
drive=[drive], primary=1, grow=1, format=1) |
drive=[drive], primary=1, grow=1, format=1) |
198 |
request.uniqueID = uniqueID + 50 |
request.uniqueID = uniqueID + 50 |
199 |
raid2.append(uniqueID + 50) |
raid2.append(uniqueID + 50) |
200 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
201 |
else: |
else: |
202 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
203 |
drive=[drive], size=swapMin/(len(drives)-spares-max(0,level-4))+10, grow=1, |
drive=[drive], size=swapMin/(len(drives)-spares-max(0,level-4))+10, grow=1, |
204 |
maxSizeMB=swapMax/(len(drives)-spares-max(0,level-4)), format=1, primary=1) |
maxSizeMB=swapMax/(len(drives)-spares-max(0,level-4)), format=1, primary=1) |
205 |
request.uniqueID = uniqueID + 30 |
request.uniqueID = uniqueID + 30 |
206 |
raid2.append(uniqueID + 30) |
raid2.append(uniqueID + 30) |
207 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
208 |
|
|
209 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
210 |
size=1500/(len(drives)-spares-max(0,level-4)), |
size=1500/(len(drives)-spares-max(0,level-4)), |
211 |
drive=[drive], grow=1, primary=1, format=1) |
drive=[drive], grow=1, primary=1, format=1) |
212 |
request.uniqueID = uniqueID + 60 |
request.uniqueID = uniqueID + 60 |
213 |
raid3.append(uniqueID + 60) |
raid3.append(uniqueID + 60) |
215 |
|
|
216 |
uniqueID = uniqueID + 1 |
uniqueID = uniqueID + 1 |
217 |
|
|
218 |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), |
219 |
mountpoint="/boot", raidmembers=raid1, raidlevel="RAID1", raidminor=1, format=1, |
mountpoint="/boot", raidmembers=raid1, raidlevel="RAID1", raidminor=1, format=1, |
220 |
raidspares=0)) |
raidspares=0)) |
221 |
|
|
222 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
223 |
request = partRequests.RaidRequestSpec(fileSystemTypeGet("physical volume (LVM)"), |
request = partRequests.RaidRequestSpec(fileSystemTypeGet("physical volume (LVM)"), |
224 |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, |
225 |
raidspares=spares) |
raidspares=spares) |
226 |
request.uniqueID = 200 |
request.uniqueID = 200 |
227 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
228 |
else: |
else: |
229 |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"), |
230 |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares)) |
raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares)) |
231 |
|
|
232 |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"), |
233 |
mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1, |
mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1, |
234 |
raidspares=spares)) |
raidspares=spares)) |
235 |
|
|
236 |
else: |
else: |
237 |
for drive in drives: |
for drive in drives: |
238 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
239 |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
240 |
|
|
241 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
268 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
269 |
mountpoint="/var", size=1024, maxSizeMB=4096, volgroup=201, lvname="var", grow=1, format=1)) |
mountpoint="/var", size=1024, maxSizeMB=4096, volgroup=201, lvname="var", grow=1, format=1)) |
270 |
|
|
271 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
272 |
mountpoint="/home/e-smith/files", size=1024, maxSizeMB=8192, volgroup=201, lvname="files", grow=1, format=1)) |
mountpoint="/home/e-smith/files", size=1024, maxSizeMB=8192, volgroup=201, lvname="files", grow=1, format=1)) |
273 |
|
|
274 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
277 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
278 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
279 |
|
|
280 |
partitions.autoClearPartType = clear |
partitions.autoClearPartType = CLEARPART_TYPE_ALL |
281 |
partitions.autoClearPartDrives = drives |
partitions.autoClearPartDrives = drives |
282 |
self.doPartition = False |
self.doPartition = False |
283 |
else: |
else: |