def doClearPart(self, args):
        KickstartHandlers.doClearPart(self, args)
        dict = self.ksdata.clearpart

        hds = isys.hardDriveDict().keys()
        for disk in dict["drives"]:
            if disk not in hds:
                raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent disk %s in clearpart command" % disk)

        self.id.instClass.setClearParts(self.id, dict["type"], drives=dict["drives"],
                                        initAll=dict["initAll"])
예제 #2
0
파일: kickstart.py 프로젝트: hocks/core
    def doClearPart(self, args):
        KickstartHandlers.doClearPart(self, args)
        dict = self.ksdata.clearpart

        hds = isys.hardDriveDict().keys()
        for disk in dict["drives"]:
            if disk not in hds:
                raise KickstartValueError, formatErrorMsg(
                    self.lineno,
                    msg="Specified nonexistent disk %s in clearpart command" %
                    disk)

        self.id.instClass.setClearParts(self.id,
                                        dict["type"],
                                        drives=dict["drives"],
                                        initAll=dict["initAll"])
예제 #3
0
def makeDriveDeviceNodes():
    hardDrives = isys.hardDriveDict()
    for drive in hardDrives.keys():
        if drive.startswith("mapper"):
            continue
        isys.makeDevInode(drive, "/dev/%s" % (drive, ))

        if drive.startswith("hd"):
            num = 32
        elif drive.startswith("dasd"):
            num = 4
        else:
            num = 15

        if (drive.startswith("cciss") or drive.startswith("ida")
                or drive.startswith("rd") or drive.startswith("sx8")):
            sep = "p"
        else:
            sep = ""

        for i in range(1, num):
            dev = "%s%s%d" % (drive, sep, i)
            isys.makeDevInode(dev, "/dev/%s" % (dev, ))

    cdroms = isys.cdromList()
    for drive in cdroms:
        isys.makeDevInode(drive, "/dev/%s" % (drive, ))

    tapeDrives = isys.tapeDriveList()
    for drive in tapeDrives:
        # make all tape device variants (stX,stXl,stXm,stXa,nstX,nstXl,nstXm,nstXa)
        for prefix in ("", "n"):
            for postfix in ("", "l", "m", "a"):
                device = "%s%s%s" % (prefix, drive, postfix)
                isys.makeDevInode(device, "/dev/%s" % (device, ))

    for mdMinor in range(0, 32):
        md = "md%d" % (mdMinor, )
        isys.makeDevInode(md, "/dev/%s" % (md, ))

    # make the node for the device mapper
    makeDMNode()
예제 #4
0
파일: iutil.py 프로젝트: Sudoka/base
def makeDriveDeviceNodes():
    hardDrives = isys.hardDriveDict()
    for drive in hardDrives.keys():
        if drive.startswith("mapper"):
            continue
        isys.makeDevInode(drive, "/dev/%s" % (drive,))

        if drive.startswith("hd"):
            num = 32
        elif drive.startswith("dasd"):
            num = 4
        else:
            num = 15

        if (drive.startswith("cciss") or drive.startswith("ida") or
            drive.startswith("rd") or drive.startswith("sx8")):
            sep = "p"
        else:
            sep = ""

        for i in range(1, num):
            dev = "%s%s%d" % (drive, sep, i)
            isys.makeDevInode(dev, "/dev/%s" % (dev,))

    cdroms = isys.cdromList()
    for drive in cdroms:
        isys.makeDevInode(drive, "/dev/%s" % (drive,))

    tapeDrives = isys.tapeDriveList()
    for drive in tapeDrives:
        # make all tape device variants (stX,stXl,stXm,stXa,nstX,nstXl,nstXm,nstXa)
        for prefix in ("", "n"):
            for postfix in ("", "l", "m", "a"):
                device = "%s%s%s" % (prefix, drive, postfix)
                isys.makeDevInode(device, "/dev/%s" % (device,))

    for mdMinor in range(0, 32):
        md = "md%d" %(mdMinor,)
        isys.makeDevInode(md, "/dev/%s" %(md,))

    # make the node for the device mapper
    makeDMNode()
예제 #5
0
    def drivesByName (self):
        """Return a dictionary of the drives on the system."""
	return isys.hardDriveDict()
예제 #6
0
    def driveList (self):
        """Return the list of drives on the system."""
	drives = isys.hardDriveDict().keys()
	drives.sort (isys.compareDrives)
	return drives
    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"])
예제 #8
0
파일: kickstart.py 프로젝트: hocks/core
    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"])