def setDefaultPartitioning(self, storage, platform): autorequests = [ PartSpec(mountpoint="/", fstype=storage.defaultFSType, size=1024, maxSize=50 * 1024, grow=True, asVol=True), PartSpec(mountpoint="/home", fstype=storage.defaultFSType, size=100, grow=True, asVol=True, requiredSpace=50 * 1024) ] bootreq = platform.setDefaultPartitioning() if bootreq: autorequests.extend(bootreq) (minswap, maxswap) = iutil.swapSuggestion() autorequests.append( PartSpec(fstype="swap", size=minswap, maxSize=maxswap, grow=True, asVol=True)) storage.autoPartitionRequests = autorequests
def setDefaultPartitioning(self, storage, platform): autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, size=10240, grow=True, asVol=False, requiredSpace=20*1024)] bootreq = platform.setDefaultPartitioning() if bootreq: autorequests.extend(bootreq) (minswap, maxswap) = iutil.swapSuggestion() autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, grow=True, asVol=False)) storage.autoPartitionRequests = autorequests storage.doAutoPart = True
def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_LINUX, doClear = 1): autorequests = [ ("/", None, 1024, None, 1, 1, 1) ] bootreq = getAutopartitionBoot() if bootreq: autorequests.extend(bootreq) (minswap, maxswap) = iutil.swapSuggestion() autorequests.append((None, "swap", minswap, maxswap, 1, 1, 1)) if doClear: partitions.autoClearPartType = clear partitions.autoClearPartDrives = [] partitions.autoPartitionRequests = autoCreateLVMPartitionRequests(autorequests)
def setDefaultPartitioning(self, storage, platform): autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, size=1024, maxSize=50*1024, grow=True, btr=True, lv=True, encrypted=True), PartSpec(mountpoint="/home", fstype=storage.defaultFSType, size=500, grow=True, requiredSpace=50*1024, btr=True, lv=True, encrypted=True)] bootreq = platform.setDefaultPartitioning() if bootreq: autorequests.extend(bootreq) (minswap, maxswap) = iutil.swapSuggestion() autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, grow=True, lv=True, encrypted=True)) storage.autoPartitionRequests = autorequests
def setDefaultPartitioning(self, storage, platform): def is_vc_va(): try: ''' isotype_file = "/root/isotype" strs = file(isotype_file).read() ''' import fvi x = fvi.get_iso_type() if "vCenter" in x or "vAccess" in x: return True except: pass return False # autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, # size=1024, maxSize=50*1024, grow=True, # asVol=True), # PartSpec(mountpoint="/home", fstype=storage.defaultFSType, # size=100, grow=True, asVol=True, requiredSpace=50*1024)] if is_vc_va(): autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, size=13*1024, grow=True, asVol=True), PartSpec(mountpoint="/var", fstype=storage.defaultFSType, size=20*1024, grow=True, asVol=True)] else: autorequests = [PartSpec(mountpoint="/", fstype=storage.defaultFSType, size=13*1024, maxSize=13*1024, grow=False, asVol=True), PartSpec(mountpoint="/var", fstype=storage.defaultFSType, size=20*1024, maxSize=20*1024, grow=False, asVol=True)] bootreq = platform.setDefaultPartitioning() if bootreq: autorequests.extend(bootreq) (minswap, maxswap) = iutil.swapSuggestion() autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap, grow=False, asVol=True)) storage.autoPartitionRequests = autorequests
def doPartition(self, args): KickstartHandlers.doPartition(self, args) pd = self.ksdata.partitions[-1] uniqueID = None if pd.onbiosdisk != "": pd.disk = isys.doGetBiosDisk(pd.onbiosdisk) if pd.disk == "": raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified BIOS disk %s cannot be determined" % pd.onbiosdisk) if pd.mountpoint == "swap": filesystem = fileSystemTypeGet('swap') pd.mountpoint = "" if pd.recommended: (pd.size, pd.maxSizeMB) = iutil.swapSuggestion() pd.grow = True # if people want to specify no mountpoint for some reason, let them # this is really needed for pSeries boot partitions :( elif pd.mountpoint == "None": pd.mountpoint = "" if pd.fstype: filesystem = fileSystemTypeGet(pd.fstype) else: filesystem = fileSystemTypeGetDefault() elif pd.mountpoint == 'appleboot': filesystem = fileSystemTypeGet("Apple Bootstrap") pd.mountpoint = "" elif pd.mountpoint == 'prepboot': filesystem = fileSystemTypeGet("PPC PReP Boot") pd.mountpoint = "" elif pd.mountpoint.startswith("raid."): filesystem = fileSystemTypeGet("software RAID") if self.ksRaidMapping.has_key(pd.mountpoint): raise KickstartValueError, formatErrorMsg(self.lineno, msg="Defined RAID partition multiple times") if pd.encrypted: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Software RAID partitions cannot be encrypted") # get a sort of hackish id uniqueID = self.ksID self.ksRaidMapping[pd.mountpoint] = uniqueID self.ksID += 1 pd.mountpoint = "" elif pd.mountpoint.startswith("pv."): filesystem = fileSystemTypeGet("physical volume (LVM)") if self.ksPVMapping.has_key(pd.mountpoint): raise KickstartValueError, formatErrorMsg(self.lineno, msg="Defined PV partition multiple times") # get a sort of hackish id uniqueID = self.ksID self.ksPVMapping[pd.mountpoint] = uniqueID self.ksID += 1 pd.mountpoint = "" # XXX should we let people not do this for some reason? elif pd.mountpoint == "/boot/efi": filesystem = fileSystemTypeGet("vfat") else: if pd.fstype != "": filesystem = fileSystemTypeGet(pd.fstype) else: filesystem = fileSystemTypeGetDefault() if pd.size is None and (pd.start == 0 and pd.end == 0) and pd.onPart == "": raise KickstartValueError, formatErrorMsg(self.lineno, msg="Partition requires a size specification") if pd.start != 0 and pd.disk == "": raise KickstartValueError, formatErrorMsg(self.lineno, msg="Partition command with start cylinder requires a drive specification") hds = isys.hardDriveDict() if not hds.has_key(pd.disk) and hds.has_key('mapper/'+pd.disk): pd.disk = 'mapper/' + pd.disk if pd.disk != "" and pd.disk not in hds.keys(): raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in partition command" % pd.disk) request = partRequests.PartitionSpec(filesystem, mountpoint = pd.mountpoint, format = pd.format, fslabel = pd.label, bytesPerInode = pd.bytesPerInode) if pd.size is not None: request.size = pd.size if pd.start != 0: request.start = pd.start if pd.end != 0: request.end = pd.end if pd.grow: request.grow = pd.grow if pd.maxSizeMB != 0: request.maxSizeMB = pd.maxSizeMB if pd.disk != "": request.drive = [ pd.disk ] if pd.primOnly: request.primary = pd.primOnly if uniqueID: request.uniqueID = uniqueID if pd.onPart != "": request.device = pd.onPart for areq in self.id.partitions.autoPartitionRequests: if areq.device is not None and areq.device == pd.onPart: raise KickstartValueError, formatErrorMsg(self.lineno, "Partition already used") if pd.fsopts != "": request.fsopts = pd.fsopts if pd.encrypted: try: passphrase = pd.passphrase except AttributeError: passphrase = "" if passphrase and not self.id.partitions.encryptionPassphrase: self.id.partitions.encryptionPassphrase = passphrase request.encryption = cryptodev.LUKSDevice(passphrase=passphrase, format=pd.format) self.id.instClass.addPartRequest(self.id.partitions, request) self.skipSteps.extend(["partition", "zfcpconfig", "parttype"])
def doLogicalVolume(self, args): KickstartHandlers.doLogicalVolume(self, args) lvd = self.ksdata.lvList[-1] if lvd.mountpoint == "swap": filesystem = fileSystemTypeGet("swap") lvd.mountpoint = "" if lvd.recommended: (lvd.size, lvd.maxSizeMB) = iutil.swapSuggestion() lvd.grow = True else: if lvd.fstype != "": filesystem = fileSystemTypeGet(lvd.fstype) else: filesystem = fileSystemTypeGetDefault() # sanity check mountpoint if lvd.mountpoint != "" and lvd.mountpoint[0] != '/': raise KickstartValueError, formatErrorMsg(self.lineno, msg="The mount point \"%s\" is not valid." % (lvd.mountpoint,)) try: vgid = self.ksVGMapping[lvd.vgname] except KeyError: raise KickstartValueError, formatErrorMsg(self.lineno, msg="No volume group exists with the name '%s'. Specify volume groups before logical volumes." % lvd.vgname) for areq in self.id.partitions.autoPartitionRequests: if areq.type == REQUEST_LV: if areq.volumeGroup == vgid and areq.logicalVolumeName == lvd.name: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume name already used in volume group %s" % lvd.vgname) elif areq.type == REQUEST_VG and areq.uniqueID == vgid: # Store a reference to the VG so we can do the PE size check. vg = areq if not self.ksVGMapping.has_key(lvd.vgname): raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume specifies a non-existent volume group" % lvd.name) if lvd.percent == 0 and not lvd.preexist: if lvd.size == 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Size required") elif not lvd.grow and lvd.size*1024 < vg.pesize: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Logical volume size must be larger than the volume group physical extent size.") elif (lvd.percent <= 0 or lvd.percent > 100) and not lvd.preexist: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100") request = partRequests.LogicalVolumeRequestSpec(filesystem, format = lvd.format, mountpoint = lvd.mountpoint, size = lvd.size, percent = lvd.percent, volgroup = vgid, lvname = lvd.name, grow = lvd.grow, maxSizeMB = lvd.maxSizeMB, preexist = lvd.preexist, bytesPerInode = lvd.bytesPerInode) if lvd.fsopts != "": request.fsopts = lvd.fsopts if lvd.encrypted: try: passphrase = lvd.passphrase except AttributeError: passphrase = "" if passphrase and not self.id.partitions.encryptionPassphrase: self.id.partitions.encryptionPassphrase = passphrase request.encryption = cryptodev.LUKSDevice(passphrase=passphrase, format=lvd.format) self.id.instClass.addPartRequest(self.id.partitions, request) self.skipSteps.extend(["partition", "zfcpconfig", "parttype"])
def doPartition(self, args): KickstartHandlers.doPartition(self, args) pd = self.ksdata.partitions[-1] uniqueID = None if pd.onbiosdisk != "": pd.disk = isys.doGetBiosDisk(pd.onbiosdisk) if not pd.disk: raise KickstartValueError, formatErrorMsg( self.lineno, msg="Specified BIOS disk %s cannot be determined" % pd.onbiosdisk) if pd.mountpoint == "swap": filesystem = fileSystemTypeGet('swap') pd.mountpoint = "" if pd.recommended: (pd.size, pd.maxSizeMB) = iutil.swapSuggestion() pd.grow = True # if people want to specify no mountpoint for some reason, let them # this is really needed for pSeries boot partitions :( elif pd.mountpoint == "None": pd.mountpoint = "" if pd.fstype: filesystem = fileSystemTypeGet(pd.fstype) else: filesystem = fileSystemTypeGetDefault() elif pd.mountpoint == 'appleboot': filesystem = fileSystemTypeGet("Apple Bootstrap") pd.mountpoint = "" elif pd.mountpoint == 'prepboot': filesystem = fileSystemTypeGet("PPC PReP Boot") pd.mountpoint = "" elif pd.mountpoint.startswith("raid."): filesystem = fileSystemTypeGet("software RAID") if self.ksRaidMapping.has_key(pd.mountpoint): raise KickstartValueError, formatErrorMsg( self.lineno, msg="Defined RAID partition multiple times") if pd.encrypted: raise KickstartValueError, formatErrorMsg( self.lineno, msg="Software RAID partitions cannot be encrypted") # get a sort of hackish id uniqueID = self.ksID self.ksRaidMapping[pd.mountpoint] = uniqueID self.ksID += 1 pd.mountpoint = "" elif pd.mountpoint.startswith("pv."): filesystem = fileSystemTypeGet("physical volume (LVM)") if self.ksPVMapping.has_key(pd.mountpoint): raise KickstartValueError, formatErrorMsg( self.lineno, msg="Defined PV partition multiple times") # get a sort of hackish id uniqueID = self.ksID self.ksPVMapping[pd.mountpoint] = uniqueID self.ksID += 1 pd.mountpoint = "" # XXX should we let people not do this for some reason? elif pd.mountpoint == "/boot/efi": filesystem = fileSystemTypeGet("vfat") else: if pd.fstype != "": filesystem = fileSystemTypeGet(pd.fstype) else: filesystem = fileSystemTypeGetDefault() if pd.size is None and (pd.start == 0 and pd.end == 0) and pd.onPart == "": raise KickstartValueError, formatErrorMsg( self.lineno, msg="Partition requires a size specification") if pd.start != 0 and pd.disk == "": raise KickstartValueError, formatErrorMsg( self.lineno, msg= "Partition command with start cylinder requires a drive specification" ) hds = isys.hardDriveDict() if not hds.has_key(pd.disk) and hds.has_key('mapper/' + pd.disk): pd.disk = 'mapper/' + pd.disk if pd.disk != "" and pd.disk not in hds.keys(): raise KickstartValueError, formatErrorMsg( self.lineno, msg="Specified nonexistent disk %s in partition command" % pd.disk) request = partRequests.PartitionSpec(filesystem, mountpoint=pd.mountpoint, format=pd.format, fslabel=pd.label, bytesPerInode=pd.bytesPerInode) if pd.size is not None: request.size = pd.size if pd.start != 0: request.start = pd.start if pd.end != 0: request.end = pd.end if pd.grow: request.grow = pd.grow if pd.maxSizeMB != 0: request.maxSizeMB = pd.maxSizeMB if pd.disk != "": request.drive = [pd.disk] if pd.primOnly: request.primary = pd.primOnly if uniqueID: request.uniqueID = uniqueID if pd.onPart != "": request.device = pd.onPart for areq in self.id.partitions.autoPartitionRequests: if areq.device is not None and areq.device == pd.onPart: raise KickstartValueError, formatErrorMsg( self.lineno, "Partition already used") if pd.fsopts != "": request.fsopts = pd.fsopts if pd.encrypted: try: passphrase = pd.passphrase except AttributeError: passphrase = "" if passphrase and not self.id.partitions.encryptionPassphrase: self.id.partitions.encryptionPassphrase = passphrase request.encryption = cryptodev.LUKSDevice(passphrase=passphrase, format=pd.format) self.id.instClass.addPartRequest(self.id.partitions, request) self.skipSteps.extend(["partition", "zfcpconfig", "parttype"])
def doLogicalVolume(self, args): KickstartHandlers.doLogicalVolume(self, args) lvd = self.ksdata.lvList[-1] if lvd.mountpoint == "swap": filesystem = fileSystemTypeGet("swap") lvd.mountpoint = "" if lvd.recommended: (lvd.size, lvd.maxSizeMB) = iutil.swapSuggestion() lvd.grow = True else: if lvd.fstype != "": filesystem = fileSystemTypeGet(lvd.fstype) else: filesystem = fileSystemTypeGetDefault() # sanity check mountpoint if lvd.mountpoint != "" and lvd.mountpoint[0] != '/': raise KickstartValueError, formatErrorMsg( self.lineno, msg="The mount point \"%s\" is not valid." % (lvd.mountpoint, )) try: vgid = self.ksVGMapping[lvd.vgname] except KeyError: raise KickstartValueError, formatErrorMsg( self.lineno, msg= "No volume group exists with the name '%s'. Specify volume groups before logical volumes." % lvd.vgname) for areq in self.id.partitions.autoPartitionRequests: if areq.type == REQUEST_LV: if areq.volumeGroup == vgid and areq.logicalVolumeName == lvd.name: raise KickstartValueError, formatErrorMsg( self.lineno, msg= "Logical volume name already used in volume group %s" % lvd.vgname) elif areq.type == REQUEST_VG and areq.uniqueID == vgid: # Store a reference to the VG so we can do the PE size check. vg = areq if not self.ksVGMapping.has_key(lvd.vgname): raise KickstartValueError, formatErrorMsg( self.lineno, msg="Logical volume specifies a non-existent volume group" % lvd.name) if lvd.percent == 0 and not lvd.preexist: if lvd.size == 0: raise KickstartValueError, formatErrorMsg(self.lineno, msg="Size required") elif not lvd.grow and lvd.size * 1024 < vg.pesize: raise KickstartValueError, formatErrorMsg( self.lineno, msg= "Logical volume size must be larger than the volume group physical extent size." ) elif (lvd.percent <= 0 or lvd.percent > 100) and not lvd.preexist: raise KickstartValueError, formatErrorMsg( self.lineno, msg="Percentage must be between 0 and 100") request = partRequests.LogicalVolumeRequestSpec( filesystem, format=lvd.format, mountpoint=lvd.mountpoint, size=lvd.size, percent=lvd.percent, volgroup=vgid, lvname=lvd.name, grow=lvd.grow, maxSizeMB=lvd.maxSizeMB, preexist=lvd.preexist, bytesPerInode=lvd.bytesPerInode) if lvd.fsopts != "": request.fsopts = lvd.fsopts if lvd.encrypted: try: passphrase = lvd.passphrase except AttributeError: passphrase = "" if passphrase and not self.id.partitions.encryptionPassphrase: self.id.partitions.encryptionPassphrase = passphrase request.encryption = cryptodev.LUKSDevice(passphrase=passphrase, format=lvd.format) self.id.instClass.addPartRequest(self.id.partitions, request) self.skipSteps.extend(["partition", "zfcpconfig", "parttype"])