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) |