--- cdrom.image/sme9/product/installclasses/server.py 2013/03/16 14:17:28 1.2 +++ cdrom.image/sme9/product/installclasses/server.py 2013/07/30 21:25:43 1.3 @@ -4,13 +4,15 @@ import os, iutil +import yuminstall + from installclass import BaseInstallClass -from rhel import InstallClass as SMEInstallClass from kickstart import AnacondaKSScript as Script from flags import flags from constants import * from pykickstart.constants import * +from storage.partspec import * import gettext _ = lambda x: gettext.ldgettext("anaconda", x) @@ -74,7 +76,7 @@ class Script: if serial or self.logfile: os.chmod("%s" % messages, 0600) -class InstallClass(SMEInstallClass): +class InstallClass(BaseInstallClass): # make sure the translation data is read from product.img tree if os.path.isdir("/tmp/product/locale"): import gettext @@ -116,7 +118,7 @@ class InstallClass(SMEInstallClass): if anaconda.intf is not None: w.pop() - SMEInstallClass.postAction(self, anaconda) + BaseInstallClass.postAction(self, anaconda) def setSteps(self, anaconda): BaseInstallClass.setSteps(self, anaconda) @@ -129,23 +131,50 @@ class InstallClass(SMEInstallClass): anaconda.dispatch.skipStep("firstboot") def setDefaultPartitioning(self, storage, platform): - autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, - size=1024, maxSize=50*1024, grow=True, asVol=True)] + autorequests = [] + + # If user specifies "nolvm", then asVol = False; otherwise, asVol = True + # If asVol = False below, then LVM won't be used + + asVol_flag = not flags.cmdline.has_key("nolvm") + + # If user specifies "noraid", then useRAID = False; otherwise, useRAID = True + # If useRAID = False below, then RAID1 won't be used + + useRAID_flag = not flags.cmdline.has_key("noraid") + + fstype = "ext3" + if flags.cmdline.has_key("ext4"): + fstype = "ext4" - bootreq = platform.setDefaultPartitioning() - if bootreq: - autorequests.extend(bootreq) + # /boot + # Manually specify fstype = ext3/ext4 and size = 100 MB + # (Platform default is fstype ext4 and size = 500 MB) + + autorequests.append(PartSpec(mountpoint="/boot", fstype=fstype, size=100, useRAID=useRAID_flag, + weight=platform.weight(mountpoint="/boot"))) + + # / + # Manually specify fstype = ext3/ext4 and size = 2048 MB, but growable + + autorequests.append(PartSpec(mountpoint="/", fstype=fstype, size=2048, useRAID=useRAID_flag, + grow=True, asVol=asVol_flag)) + + # swap + # Manually specify fstype = swap and minswap < size < maxswap (growable) (minswap, maxswap) = iutil.swapSuggestion() - autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, - grow=True, asVol=True)) + autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, useRAID=useRAID_flag, + grow=True, asVol=asVol_flag)) storage.autoPartitionRequests = autorequests def setInstallData(self, anaconda): - SMEInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setInstallData(self, anaconda) anaconda.id.security.setSELinux(SELINUX_DISABLED) - anaconda.id.storage.clearPartType = CLEARPART_TYPE_ALL + self.setDefaultPartitioning( + anaconda.id.storage, + anaconda.platform) def productMatches(self, oldprod): if oldprod is None: @@ -156,5 +185,8 @@ class InstallClass(SMEInstallClass): return False + def getBackend(self): + return yuminstall.YumBackend + def __init__(self): - SMEInstallClass.__init__(self) + BaseInstallClass.__init__(self)