def setInstallData (self, anaconda):
        BaseInstallClass.setInstallData(self, anaconda)
        self.setEarlySwapOn(1)
        self.anaconda = anaconda
        self.id = self.anaconda.id
        self.id.firstboot = FIRSTBOOT_SKIP

        # make sure our disks are alive
        from partedUtils import DiskSet
        ds = DiskSet(self.anaconda)
        ds.startMPath()
        ds.startDmRaid()

        # parse the %pre
        self.ksdata = KickstartData()
        self.ksparser = KickstartPreParser(self.ksdata, None)

        try:
            self.ksparser.readKickstart(self.file)
        except KickstartError, e:
           if anaconda.intf:
               anaconda.intf.kickstartErrorWindow(e.__str__())
               sys.exit(0)
           else:
               raise KickstartError, e
    def doDmRaid(self, args):
        KickstartHandlers.doDmRaid(self, args)

        from partedUtils import DiskSet
        ds = DiskSet(self.anaconda)
        ds.startDmRaid()

        raid = self.ksdata.dmraids[-1]
        log.debug("Searching for dmraid '%s'" % (raid.name,))
        for rs in DiskSet.dmList or []:
            it = True
            for dev in raid.devices:
                dev = dev.split('/')[-1]
                log.debug("dmraid '%s' has members %s" % (rs.name, list(rs.members)))
                if not dev in rs.members:
                    log.debug("dmraid '%s' does not have device %s, skipping" \
                        % (rs.name, dev))
                    it = False
            if it:
                log.debug("found dmraid '%s', changing name to %s" \
                    % (rs.name, raid.name))
                # why doesn't rs.name go through the setter here?
                newname = raid.name
                ds.renameDmRaid(rs, newname)
                return
        ds.startDmRaid()
Beispiel #3
0
    def doMultiPath(self, args):
        KickstartHandlers.doMultiPath(self, args)

        from partedUtils import DiskSet
        ds = DiskSet(self.anaconda)
        ds.startMPath()

        mpath = self.ksdata.mpaths[-1]
        log.debug("Searching for mpath '%s'" % (mpath.name,))
        for mp in DiskSet.mpList or []:
            it = True
            for dev in mpath.devices:
                dev = dev.split('/')[-1]
                log.debug("mpath '%s' has members %s" % (mp.name, list(mp.members)))
                if not dev in mp.members:
                    log.debug("mpath '%s' does not have device %s, skipping" \
                        % (mp.name, dev))
                    it = False
            if it:
                log.debug("found mpath '%s', changing name to %s" \
                    % (mp.name, mpath.name))
                newname = mpath.name
                ds.renameMPath(mp, newname)
                return
        ds.startMPath()
Beispiel #4
0
    def postAction(self, anaconda, serial):
        postScripts = filter(lambda s: s.type == KS_SCRIPT_POST, self.ksdata.scripts)

        if len(postScripts) == 0:
            return

        # Remove environment variables that cause problems for %post scripts.
        for var in ["LIBUSER_CONF"]:
            if os.environ.has_key(var):
                del (os.environ[var])

        # ROCKS
        # need to reread the disk set before we execute the post sections.
        # this is because of software raid. in the patch above, we read
        # the disk set *before* the software raid device is created, thus,
        # there will be no software raid device in the disk set. the first
        # post section reports the partitions back to the frontend's database,
        # so before we run that code, we need to make sure all software
        # raid devices are discovered.
        #
        from partedUtils import DiskSet

        ds = DiskSet(self.anaconda)
        diskfile = open("/tmp/discovered.disks", "w")
        disks = ds.driveList()
        ds.startMdRaid()
        diskfile.write("disks: %s\n" % (" ".join(disks)))
        swraid = []
        for dev, devices, level, numActive in ds.mdList:
            if dev not in swraid:
                swraid.append(dev)
        diskfile.write("raids: %s\n" % (" ".join(swraid)))
        diskfile.close()
        # ROCKS

        log.info("Running kickstart %%post script(s)")
        if anaconda.intf is not None:
            w = anaconda.intf.waitWindow(_("Running..."), _("Running post-install scripts"))

        map(lambda s: s.run(anaconda.rootPath, serial, anaconda.intf), postScripts)

        log.info("All kickstart %%post script(s) have been run")
        if anaconda.intf is not None:
            w.pop()
Beispiel #5
0
    def doMultiPath(self, args):
        KickstartHandlers.doMultiPath(self, args)

        from partedUtils import DiskSet

        ds = DiskSet(self.anaconda)
        ds.startMPath()

        from bdevid import bdevid as _bdevid

        bd = _bdevid()
        bd.load("scsi")

        mpath = self.ksdata.mpaths[-1]
        for mp in DiskSet.mpList or []:
            newname = ""
            it = True
            for path in mpath.paths:
                if not iutil.valid_dm_name(path.name):
                    msg = "Invalid name for a multipath device '%s' " "(resembles a partition?)." % path.name
                    raise KickstartValueError, formatErrorMsg(self.lineno, msg)
                dev = path.device
                log.debug("Searching for mpath having '%s' as a member, the scsi id or wwpn:lunid" % (dev,))
                log.debug("mpath '%s' has members %s" % (mp.name, list(mp.members)))
                if dev.find(":") != -1:
                    (wwpn, lunid) = dev.split(":")
                    if wwpn != "" and lunid != "":
                        if wwpn.startswith("0x"):
                            wwpn = wwpn[2:]
                        wwpn = wwpn.upper()
                        scsidev = iutil.getScsiDeviceByWwpnLunid(wwpn, lunid)
                        if scsidev != "":
                            dev = "/dev/%s" % scsidev
                            log.debug(
                                "'%s' is a member of the multipath device WWPN '%s' LUNID '%s'" % (dev, wwpn, lunid)
                            )
                if not dev in mp.members:
                    mpscsiid = bd.probe("/dev/mapper/%s" % mp.name)[0]["unique_id"]
                    if dev != mpscsiid:
                        log.debug("mpath '%s' does not have device %s, skipping" % (mp.name, dev))
                        it = False
                    else:
                        log.debug("Recognized --device=%s as the scsi id of '%s'" % (dev, mp.name))
                        newname = path.name
                        break
                else:
                    log.debug("Recognized --device=%s as a member of '%s'" % (dev, mp.name))
                    newname = path.name
                    break
            if it and mp.name != newname:
                log.debug("found mpath '%s', changing name to %s" % (mp.name, newname))
                mpath.name = mp.name
                ds.renameMPath(mp, newname)
                bd.unload("scsi")
                return
        bd.unload("scsi")
        ds.startMPath()
 def _removeDisk(self, drive, addSkip=True):
     if not isinstance(drive, PsudoDisk) and not (self.disks.has_key(drive) and isinstance(self.disks[drive], PsudoDisk)):
         DiskSet._removeDisk(self, drive, addSkip)
 def _removeDisk(self, drive, addSkip=True):
     if not isinstance(drive, PseudoDisk):
         DiskSet._removeDisk(self, drive, addSkip)