/[smeserver]/cdrom.image/sme7/product/installclasses/smeinstallclass.py
ViewVC logotype

Diff of /cdrom.image/sme7/product/installclasses/smeinstallclass.py

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

Revision 1.2 by slords, Sun Jun 7 02:30:05 2009 UTC Revision 1.5 by slords, Mon Nov 30 23:46:26 2009 UTC
# Line 13  import partedUtils Line 13  import partedUtils
13    
14  class Script:  class Script:
15      def __repr__(self):      def __repr__(self):
16          str = ("(s: '%s' i: %s c: %d)") %  \          str = ("(s: '%s' i: %s c: %d)") % \
17              (self.script, self.interp, self.inChroot)              (self.script, self.interp, self.inChroot)
18          return string.replace(str, "\n", "|")          return string.replace(str, "\n", "|")
19    
# Line 61  class InstallClass(BaseInstallClass): Line 61  class InstallClass(BaseInstallClass):
61                       "will be repartitioned and formated.")                       "will be repartitioned and formated.")
62    
63      sortPriority = 1      sortPriority = 1
   
     cmdline = {}  
64      doPartition = False      doPartition = False
65        cmdline = {}
66    
67      parentClass = ( _("Install SME Server"), "smeserver.png" )      parentClass = ( _("Install SME Server"), "smeserver.png" )
68    
# Line 133  class InstallClass(BaseInstallClass): Line 132  class InstallClass(BaseInstallClass):
132                   "complete"                   "complete"
133                  )                  )
134    
   
135          # 'partition' can be used on the command line to force          # 'partition' can be used on the command line to force
136          # verification of partitions.  useful in some cases...          # verification of partitions.  useful in some cases...
137          if self.doPartition or self.cmdline.has_key("partition"):          if self.doPartition or self.cmdline.has_key("partition"):
# Line 145  class InstallClass(BaseInstallClass): Line 143  class InstallClass(BaseInstallClass):
143          self.cmdline = self.createCmdlineDict()          self.cmdline = self.createCmdlineDict()
144          diskset = partedUtils.DiskSet()          diskset = partedUtils.DiskSet()
145    
146          alldrives = diskset.driveList()          if self.cmdline.has_key("exclude"):
147                alldrives = filter(lambda x:not x in self.cmdline["exclude"].split(","), diskset.driveList())
148            else:
149                alldrives = diskset.driveList()
150    
151          if self.cmdline.has_key("drives"):          if self.cmdline.has_key("drives"):
152              drives = filter(lambda x:self.mediaPresent(x) and              if self.cmdline["drives"] == "all":
153                                       x in self.cmdline["drives"].split(","), alldrives)                  drives = filter(lambda x:self.mediaPresent(x), alldrives)
154                else:
155                    drives = filter(lambda x:self.mediaPresent(x) and
156                                             x in self.cmdline["drives"].split(","), alldrives)
157          else:          else:
158              drives = filter(lambda x:not isys.driveIsRemovable(x) and              drives = filter(lambda x:not isys.driveIsRemovable(x) and
159                                       self.mediaPresent(x) and                                       self.mediaPresent(x) and
160                                       not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)                                       not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)
161    
162          if self.cmdline.has_key("spares"):          if self.cmdline.has_key("spares"):
163              spares = max(0,min(int(self.cmdline["spares"]),len(drives)-2))              if self.cmdline["spares"] == "none":
164                    spares = 0
165                else:
166                    try:
167                        spares = max(0,min(int(self.cmdline["spares"]),len(drives)-2))
168                    except:
169                        spares = (len(drives)+4)/7
170          else:          else:
171              spares = (len(drives)+4)/7              spares = (len(drives)+4)/7
172    
# Line 184  class InstallClass(BaseInstallClass): Line 195  class InstallClass(BaseInstallClass):
195                  level = 1                  level = 1
196    
197          if len(drives) >= 1:          if len(drives) >= 1:
198                excluded = filter(lambda x:x not in drives, diskset.driveList())
199              log("Using the following drives: %s" % drives)              log("Using the following drives: %s" % drives)
200                log("Excluding the following drives: %s" % excluded)
201              if level >= 1:              if level >= 1:
202                  log("Installing using RAID%s" % level)                  log("Installing using RAID%s" % level)
203                  log("Using %s spare drives" % spares)                  log("Using %s spare drives" % spares)
# Line 206  class InstallClass(BaseInstallClass): Line 219  class InstallClass(BaseInstallClass):
219                      partitions.autoPartitionRequests.append(request)                      partitions.autoPartitionRequests.append(request)
220    
221                      if not self.cmdline.has_key("nolvm"):                      if not self.cmdline.has_key("nolvm"):
222                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                          if not self.cmdline.has_key("multipart"):
223                                  size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)),                              request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
224                                  drive=[drive], primary=1, grow=1, format=1)                                      size=(swapMin+1536)/(len(drives)-spares-max(0,level-4)),
225                                        drive=[drive], primary=1, grow=1, format=1)
226                            else:
227                                request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
228                                        size=(swapMin+5120)/(len(drives)-spares-max(0,level-4)),
229                                        drive=[drive], primary=1, grow=1, format=1)
230                          request.uniqueID = uniqueID + 50                          request.uniqueID = uniqueID + 50
231                          raid2.append(uniqueID + 50)                          raid2.append(uniqueID + 50)
232                          partitions.autoPartitionRequests.append(request)                          partitions.autoPartitionRequests.append(request)
# Line 221  class InstallClass(BaseInstallClass): Line 239  class InstallClass(BaseInstallClass):
239                          partitions.autoPartitionRequests.append(request)                          partitions.autoPartitionRequests.append(request)
240    
241                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
242                                  size=1500/(len(drives)-spares-max(0,level-4)),                                  size=1536/(len(drives)-spares-max(0,level-4)),
243                                  drive=[drive], grow=1, primary=1, format=1)                                  drive=[drive], grow=1, primary=1, format=1)
244                          request.uniqueID = uniqueID + 60                          request.uniqueID = uniqueID + 60
245                          raid3.append(uniqueID + 60)                          raid3.append(uniqueID + 60)
# Line 244  class InstallClass(BaseInstallClass): Line 262  class InstallClass(BaseInstallClass):
262                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares))                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares))
263    
264                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),
265                              mountpoint="/", raidmembers=raid3,  raidlevel="RAID"+str(level), raidminor=3, format=1,                              mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1,
266                              raidspares=spares))                              raidspares=spares))
267    
268              else:              else:
269                  for drive in drives:                  for drive in drives:
270                      partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),
271                          mountpoint="/boot", drive=[drive], size=100, primary=1, format=1))                              mountpoint="/boot", drive=[drive], size=100, primary=1, format=1))
272    
273                      if not self.cmdline.has_key("nolvm"):                      if not self.cmdline.has_key("nolvm"):
274                          request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"),                          if not self.cmdline.has_key("multipart"):
275                                  drive=[drive], size=swapMin+4096, grow=1, primary=1, format=1)                              request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"),
276                                        drive=[drive], size=swapMin+1536, grow=1, primary=1, format=1)
277                            else:
278                                request = partRequests.PartitionSpec(fileSystemTypeGet("physical volume (LVM)"),
279                                        drive=[drive], size=swapMin+5120, grow=1, primary=1, format=1)
280                          request.uniqueID = 200                          request.uniqueID = 200
281                          partitions.autoPartitionRequests.append(request)                          partitions.autoPartitionRequests.append(request)
282                      else:                      else:
283                          partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),                          partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),
284                                  mountpoint="/", drive=[drive], size=4096, grow=1, primary=1, format=1))                                  mountpoint="/", drive=[drive], size=1536, grow=1, primary=1, format=1))
285    
286                          partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"),                          partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("swap"),
287                                  drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1))                                  drive=[drive], size=swapMin, maxSizeMB=swapMax, grow=1, primary=1, format=1))
# Line 271  class InstallClass(BaseInstallClass): Line 293  class InstallClass(BaseInstallClass):
293    
294                  if not self.cmdline.has_key("multipart"):                  if not self.cmdline.has_key("multipart"):
295                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
296                              mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1))                              mountpoint="/", size=1536, volgroup=201, lvname="root", grow=1, format=1))
297    
298                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),
299                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))
# Line 286  class InstallClass(BaseInstallClass): Line 308  class InstallClass(BaseInstallClass):
308                              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))
309    
310                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
311                              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))
312    
313                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),
314                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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