132 |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): |
133 |
diskset = partedUtils.DiskSet() |
diskset = partedUtils.DiskSet() |
134 |
|
|
135 |
alldrives = diskset.driveList() |
if flags.cmdline.has_key("exclude"): |
136 |
|
alldrives = filter(lambda x:not x in flags.cmdline["exclude"].split(","), diskset.driveList()) |
137 |
|
else: |
138 |
|
alldrives = diskset.driveList() |
139 |
|
|
140 |
if flags.cmdline.has_key("drives"): |
if flags.cmdline.has_key("drives"): |
141 |
drives = filter(lambda x:isys.mediaPresent(x) and |
if flags.cmdline["drives"] == "all": |
142 |
x in flags.cmdline["drives"].split(","), alldrives) |
drives = filter(lambda x:isys.mediaPresent(x), alldrives) |
143 |
|
else: |
144 |
|
drives = filter(lambda x:isys.mediaPresent(x) and |
145 |
|
x in flags.cmdline["drives"].split(","), alldrives) |
146 |
else: |
else: |
147 |
drives = filter(lambda x:not self.driveIsRemovable(x) and |
drives = filter(lambda x:not self.driveIsRemovable(x) and |
148 |
isys.mediaPresent(x) and |
isys.mediaPresent(x) and |
149 |
not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives) |
150 |
|
|
151 |
if flags.cmdline.has_key("spares"): |
if flags.cmdline.has_key("spares"): |
152 |
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
if flags.cmdline["spares"] == "none": |
153 |
|
spares = 0 |
154 |
|
else: |
155 |
|
try: |
156 |
|
spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2)) |
157 |
|
except: |
158 |
|
spares = (len(drives)+4)/7 |
159 |
else: |
else: |
160 |
spares = (len(drives)+4)/7 |
spares = (len(drives)+4)/7 |
161 |
|
|
184 |
level = 1 |
level = 1 |
185 |
|
|
186 |
if len(drives) >= 1: |
if len(drives) >= 1: |
187 |
|
excluded = filter(lambda x:x not in drives, diskset.driveList()) |
188 |
log.info("Using the following drives: %s" % drives) |
log.info("Using the following drives: %s" % drives) |
189 |
|
log.info("Excluding the following drives: %s" % excluded) |
190 |
if level >= 1: |
if level >= 1: |
191 |
log.info("Installing using RAID%s" % level) |
log.info("Installing using RAID%s" % level) |
192 |
log.info("Using %s spare drives" % spares) |
log.info("Using %s spare drives" % spares) |
208 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
209 |
|
|
210 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
211 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
if not flags.cmdline.has_key("multipart"): |
212 |
size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
213 |
drive=[drive], primary=1, grow=1, format=1) |
size=(swapMin+1536)/(len(drives)-spares-max(0,level-4)), |
214 |
|
drive=[drive], primary=1, grow=1, format=1) |
215 |
|
else: |
216 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
217 |
|
size=(swapMin+5120)/(len(drives)-spares-max(0,level-4)), |
218 |
|
drive=[drive], primary=1, grow=1, format=1) |
219 |
request.uniqueID = uniqueID + 50 |
request.uniqueID = uniqueID + 50 |
220 |
raid2.append(uniqueID + 50) |
raid2.append(uniqueID + 50) |
221 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
228 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
229 |
|
|
230 |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"), |
231 |
size=1500/(len(drives)-spares-max(0,level-4)), |
size=1536/(len(drives)-spares-max(0,level-4)), |
232 |
drive=[drive], grow=1, primary=1, format=1) |
drive=[drive], grow=1, primary=1, format=1) |
233 |
request.uniqueID = uniqueID + 60 |
request.uniqueID = uniqueID + 60 |
234 |
raid3.append(uniqueID + 60) |
raid3.append(uniqueID + 60) |
260 |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
mountpoint="/boot", drive=[drive], size=100, primary=1, format=1)) |
261 |
|
|
262 |
if not flags.cmdline.has_key("nolvm"): |
if not flags.cmdline.has_key("nolvm"): |
263 |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
if not flags.cmdline.has_key("multipart"): |
264 |
drive=[drive], size=swapMin+4096, grow=1, primary=1, format=1) |
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
265 |
|
drive=[drive], size=swapMin+1536, grow=1, primary=1, format=1) |
266 |
|
else: |
267 |
|
request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"), |
268 |
|
drive=[drive], size=swapMin+5120, grow=1, primary=1, format=1) |
269 |
request.uniqueID = 200 |
request.uniqueID = 200 |
270 |
partitions.autoPartitionRequests.append(request) |
partitions.autoPartitionRequests.append(request) |
271 |
else: |
else: |
272 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"), |
273 |
mountpoint="/", drive=[drive], size=4096, grow=1, primary=1, format=1)) |
mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1)) |
274 |
|
|
275 |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"), |
276 |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1)) |
282 |
|
|
283 |
if not flags.cmdline.has_key("multipart"): |
if not flags.cmdline.has_key("multipart"): |
284 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
285 |
mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1)) |
mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1)) |
286 |
|
|
287 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
288 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
297 |
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)) |
298 |
|
|
299 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"), |
300 |
mountpoint="/tmp", size=512, maxSizeMB=4096, volgroup=201, lvname="tmp", grow=1, format=1)) |
mountpoint="/tmp", size=1024, maxSizeMB=4096, volgroup=201, lvname="tmp", grow=1, format=1)) |
301 |
|
|
302 |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"), |
303 |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |
size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1)) |