/[smeserver]/cdrom.image/sme8/updates/installclasses/smeinstallclass.py
ViewVC logotype

Diff of /cdrom.image/sme8/updates/installclasses/smeinstallclass.py

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

Revision 1.1 by slords, Sat Jun 6 23:51:54 2009 UTC Revision 1.3 by slords, Mon Jun 8 14:43:07 2009 UTC
# Line 67  class InstallClass(BaseInstallClass): Line 67  class InstallClass(BaseInstallClass):
67      description = N_("This option performs a new install of "      description = N_("This option performs a new install of "
68                       "SME Server.  All attached hard drives "                       "SME Server.  All attached hard drives "
69                       "will be repartitioned and formated.")                       "will be repartitioned and formated.")
70    
71      sortPriority = 1      sortPriority = 1
72      doPartition = False      doPartition = False
73    
# Line 75  class InstallClass(BaseInstallClass): Line 76  class InstallClass(BaseInstallClass):
76      def requiredDisplayMode(self):      def requiredDisplayMode(self):
77          return 't'          return 't'
78    
79        def driveIsRemovable(self, device):
80            try:
81                removable = bool(int(open("/sys/block/%s/removable" % device).read()))
82            except:
83                removable = False
84                
85            return removable
86    
87      def setSteps(self, dispatch):      def setSteps(self, dispatch):
88          dispatch.setStepList(          dispatch.setStepList(
89                   "language",                   "language",
# Line 110  class InstallClass(BaseInstallClass): Line 119  class InstallClass(BaseInstallClass):
119                   "complete"                   "complete"
120                  )                  )
121    
122          # 'partition' can be used on the command line to force          # 'partition' can be used on the command line to force
123          # verification of partitions.  useful in some cases...          # verification of partitions.  useful in some cases...
124          if self.doPartition or flags.cmdline.has_key("partition"):          if self.doPartition or flags.cmdline.has_key("partition"):
125              if not self.doPartition:              if not self.doPartition:
# Line 125  class InstallClass(BaseInstallClass): Line 134  class InstallClass(BaseInstallClass):
134    
135          alldrives = diskset.driveList()          alldrives = diskset.driveList()
136          if flags.cmdline.has_key("drives"):          if flags.cmdline.has_key("drives"):
137              drives = filter(lambda x:isys.mediaPresent(x) and x in flags.cmdline["drives"].split(","), alldrives)              drives = filter(lambda x:isys.mediaPresent(x) and
138                                         x in flags.cmdline["drives"].split(","), alldrives)
139          else:          else:
140              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
141                                         isys.mediaPresent(x) and
142                                         not isys.driveUsesModule(x, ["usb-storage", "ub", "sbp2"]), alldrives)
143    
144          if flags.cmdline.has_key("spares"):          if flags.cmdline.has_key("spares"):
145              spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2))              spares = max(0,min(int(flags.cmdline["spares"]),len(drives)-2))
# Line 158  class InstallClass(BaseInstallClass): Line 170  class InstallClass(BaseInstallClass):
170              else:              else:
171                  level = 1                  level = 1
172    
         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()  
173          if len(drives) >= 1:          if len(drives) >= 1:
174                log.info("Using the following drives: %s" % drives)
175                if level >= 1:
176                    log.info("Installing using RAID%s" % level)
177                    log.info("Using %s spare drives" % spares)
178                else:
179                    log.warning("Installing without using RAID")
180    
181                (swapMin, swapMax) = iutil.swapSuggestion()
182              if level >= 1:              if level >= 1:
183                  raid1 = []                  raid1 = []
184                  raid2 = []                  raid2 = []
# Line 174  class InstallClass(BaseInstallClass): Line 186  class InstallClass(BaseInstallClass):
186                  uniqueID = 100                  uniqueID = 100
187    
188                  for drive in drives:                  for drive in drives:
189                      request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                      request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
190                              drive=[drive], size=100, primary=1, format=1)                              drive=[drive], size=100, primary=1, format=1)
191                      request.uniqueID = uniqueID                      request.uniqueID = uniqueID
192                      raid1.append(uniqueID)                      raid1.append(uniqueID)
193                      partitions.autoPartitionRequests.append(request)                      partitions.autoPartitionRequests.append(request)
194    
195                      if not flags.cmdline.has_key("nolvm"):                      if not flags.cmdline.has_key("nolvm"):
196                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
197                                  size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)),                                  size=(swapMin+4096)/(len(drives)-spares-max(0,level-4)),
198                                  drive=[drive], primary=1, grow=1, format=1)                                  drive=[drive], primary=1, grow=1, format=1)
199                          request.uniqueID = uniqueID + 50                          request.uniqueID = uniqueID + 50
200                          raid2.append(uniqueID + 50)                          raid2.append(uniqueID + 50)
201                          partitions.autoPartitionRequests.append(request)                          partitions.autoPartitionRequests.append(request)
202                      else:                      else:
203                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
204                                  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,
205                                  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)
206                          request.uniqueID = uniqueID + 30                          request.uniqueID = uniqueID + 30
207                          raid2.append(uniqueID + 30)                          raid2.append(uniqueID + 30)
208                          partitions.autoPartitionRequests.append(request)                          partitions.autoPartitionRequests.append(request)
209    
210                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),                          request = partRequests.PartitionSpec(fileSystemTypeGet("software RAID"),
211                                  size=1500/(len(drives)-spares-max(0,level-4)),                                  size=1500/(len(drives)-spares-max(0,level-4)),
212                                  drive=[drive], grow=1, primary=1, format=1)                                  drive=[drive], grow=1, primary=1, format=1)
213                          request.uniqueID = uniqueID + 60                          request.uniqueID = uniqueID + 60
214                          raid3.append(uniqueID + 60)                          raid3.append(uniqueID + 60)
# Line 204  class InstallClass(BaseInstallClass): Line 216  class InstallClass(BaseInstallClass):
216    
217                      uniqueID = uniqueID + 1                      uniqueID = uniqueID + 1
218    
219                  partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),                  partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),
220                          mountpoint="/boot", raidmembers=raid1, raidlevel="RAID1", raidminor=1, format=1,                          mountpoint="/boot", raidmembers=raid1, raidlevel="RAID1", raidminor=1, format=1,
221                          raidspares=0))                          raidspares=0))
222    
223                  if not flags.cmdline.has_key("nolvm"):                  if not flags.cmdline.has_key("nolvm"):
224                      request = partRequests.RaidRequestSpec(fileSystemTypeGet("physical volume (LVM)"),                      request = partRequests.RaidRequestSpec(fileSystemTypeGet("physical volume (LVM)"),
225                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1,                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1,
226                              raidspares=spares)                              raidspares=spares)
227                      request.uniqueID = 200                      request.uniqueID = 200
228                      partitions.autoPartitionRequests.append(request)                      partitions.autoPartitionRequests.append(request)
229                  else:                  else:
230                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"),                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("swap"),
231                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares))                              raidmembers=raid2, raidlevel="RAID"+str(level), raidminor=2, format=1, raidspares=spares))
232    
233                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.RaidRequestSpec(fileSystemTypeGet("ext3"),
234                              mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1,                              mountpoint="/", raidmembers=raid3, raidlevel="RAID"+str(level), raidminor=3, format=1,
235                              raidspares=spares))                              raidspares=spares))
236    
237              else:              else:
238                  for drive in drives:                  for drive in drives:
239                      partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.PartitionSpec(fileSystemTypeGet("ext3"),
240                              mountpoint="/boot", drive=[drive], size=100, primary=1, format=1))                              mountpoint="/boot", drive=[drive], size=100, primary=1, format=1))
241    
242                      if not flags.cmdline.has_key("nolvm"):                      if not flags.cmdline.has_key("nolvm"):
# Line 246  class InstallClass(BaseInstallClass): Line 258  class InstallClass(BaseInstallClass):
258    
259                  if not flags.cmdline.has_key("multipart"):                  if not flags.cmdline.has_key("multipart"):
260                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
261                          mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1))                              mountpoint="/", size=1300, volgroup=201, lvname="root", grow=1, format=1))
262    
263                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),
264                              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 257  class InstallClass(BaseInstallClass): Line 269  class InstallClass(BaseInstallClass):
269                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
270                              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))
271    
272                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
273                              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))
274    
275                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("ext3"),
# Line 266  class InstallClass(BaseInstallClass): Line 278  class InstallClass(BaseInstallClass):
278                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),                      partitions.autoPartitionRequests.append(partRequests.LogicalVolumeRequestSpec(fileSystemTypeGet("swap"),
279                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))                              size=swapMin, maxSizeMB=swapMax, volgroup=201, lvname="swap", grow=1, format=1))
280    
281              partitions.autoClearPartType = clear              partitions.autoClearPartType = CLEARPART_TYPE_ALL
282              partitions.autoClearPartDrives = drives              partitions.autoClearPartDrives = drives
283              self.doPartition = False              self.doPartition = False
284          else:          else:


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