示例#1
0
    def __str__(self):
        s = ""
        s = s + "DEVICE=" + self.info["DEVICE"] + "\n"
        keys = self.info.keys()
        keys.sort()
        keys.remove("DEVICE")
        if "DESC" in keys:
            keys.remove("DESC")
        if "KEY" in keys:
            keys.remove("KEY")
        if iutil.isS390() and ("OPTIONS" in keys) and ("HWADDR" in keys) and \
           (self.info["OPTIONS"].find("layer2=1") != -1):
            keys.remove("HWADDR")

        for key in keys:
            if (key == 'NAME') or \
               (key == 'NM_CONTROLLED' and not flags.livecdInstall):
                continue
            # make sure we include autoneg in the ethtool line
            elif key == 'ETHTOOL_OPTS' and self.info[key].find("autoneg")== -1:
                s = s + key + """="autoneg off %s"\n""" % (self.info[key])
            elif self.info[key] is not None:
                s = s + key + "=" + self.info[key] + "\n"

        return s
示例#2
0
def addDrive(anaconda):
    (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
    gui.addFrame(dialog)
    dialog.show_all()
    if not iutil.isS390():
        dxml.get_widget("zfcpRadio").hide()
        dxml.get_widget("zfcpRadio").set_group(None)

    if not storage.iscsi.has_iscsi():
        dxml.get_widget("iscsiRadio").set_sensitive(False)
        dxml.get_widget("iscsiRadio").set_active(False)
        dxml.get_widget("iscsiBindCheck").set_sensitive(False)
    else:
        dxml.get_widget("iscsiBindCheck").set_active(bool(storage.iscsi.iscsi().ifaces))
        dxml.get_widget("iscsiBindCheck").set_sensitive(storage.iscsi.iscsi().mode == "none")

    if not storage.fcoe.has_fcoe():
        dxml.get_widget("fcoeRadio").set_sensitive(False)
        dxml.get_widget("fcoeRadio").set_active(False)

    def update_active_ifaces():
        active_ifaces = network.getActiveNetDevs()
        dxml.get_widget("ifaceLabel").set_text(", ".join(active_ifaces))

    def netconfButton_clicked(*args):
        from network_gui import setupNetwork
        setupNetwork(anaconda.intf)
        update_active_ifaces()

    dxml.get_widget("netconfButton").connect("clicked", netconfButton_clicked)
    update_active_ifaces()

    #figure out what advanced devices we have available and set sensible default
    group = dxml.get_widget("iscsiRadio").get_group()
    for button in group:
        if button is not None and button.get_property("sensitive"):
            button.set_active(True)
            button.grab_focus()
            break

    rc = dialog.run()
    dialog.hide()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False

    if dxml.get_widget("iscsiRadio").get_active() and storage.iscsi.has_iscsi():
        bind = dxml.get_widget("iscsiBindCheck").get_active()
        rc = addIscsiDrive(anaconda, bind)
    elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe():
        rc = addFcoeDrive(anaconda)
    elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active():
        rc = addZfcpDrive(anaconda)

    dialog.destroy()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False
    else:
        return True
示例#3
0
def setupTimezone(anaconda):
    # we don't need this on an upgrade or going backwards
    if anaconda.id.upgrade or anaconda.dir == DISPATCH_BACK:
        return

    os.environ["TZ"] = anaconda.id.timezone.tz
    tzfile = "/usr/share/zoneinfo/" + anaconda.id.timezone.tz
    tzlocalfile = "/etc/localtime"
    if not os.access(tzfile, os.R_OK):
        log.error("unable to set timezone")
    else:
        try:
            os.remove(tzlocalfile)
        except OSError:
            pass
        try:
            shutil.copyfile(tzfile, tzlocalfile)
        except OSError as e:
            log.error("Error copying timezone (from %s): %s" %
                      (tzfile, e.strerror))

    if iutil.isS390():
        return
    args = ["--hctosys"]
    if anaconda.id.timezone.utc:
        args.append("-u")

    try:
        iutil.execWithRedirect("/usr/sbin/hwclock",
                               args,
                               stdin=None,
                               stdout="/dev/tty5",
                               stderr="/dev/tty5")
    except RuntimeError:
        log.error("Failed to set clock")
示例#4
0
    def __str__(self):
        s = ""
        s = s + "DEVICE=" + self.info["DEVICE"] + "\n"
        keys = self.info.keys()
        keys.sort()
        keys.remove("DEVICE")
        if "DESC" in keys:
            keys.remove("DESC")
        if "KEY" in keys:
            keys.remove("KEY")
        if iutil.isS390() and ("OPTIONS" in keys) and ("HWADDR" in keys) and \
           (self.info["OPTIONS"].find("layer2=1") != -1):
            keys.remove("HWADDR")

        for key in keys:
            if (key == 'NAME') or \
               (key == 'NM_CONTROLLED' and not flags.livecdInstall):
                continue
            # make sure we include autoneg in the ethtool line
            elif key == 'ETHTOOL_OPTS' and self.info[key].find(
                    "autoneg") == -1:
                s = s + key + """="autoneg off %s"\n""" % (self.info[key])
            elif self.info[key] is not None:
                s = s + key + "=" + self.info[key] + "\n"

        return s
示例#5
0
def doReIPL(anaconda):
    if not iutil.isS390() or anaconda.dir == DISPATCH_BACK:
        return DISPATCH_NOOP

    anaconda.reIPLMessage = iutil.reIPL(anaconda, os.getppid())

    return DISPATCH_FORWARD
def getPlatform(anaconda):
    """Check the architecture of the system and return an instance of a
       Platform subclass to match.  If the architecture could not be determined,
       raise an exception."""
    if iutil.isAlpha():
        return Alpha(anaconda)
    elif iutil.isIA64():
        return IA64(anaconda)
    elif iutil.isPPC():
        ppcMachine = iutil.getPPCMachine()

        if (ppcMachine == "PMac" and iutil.getPPCMacGen() == "NewWorld"):
            return NewWorldPPC(anaconda)
        elif ppcMachine in ["iSeries", "pSeries"]:
            return IPSeriesPPC(anaconda)
        elif ppcMachine == "PS3":
            return PS3(anaconda)
        else:
            raise SystemError, "Unsupported PPC machine type"
    elif iutil.isS390():
        return S390(anaconda)
    elif iutil.isSparc():
        return Sparc(anaconda)
    elif iutil.isX86():
        return X86(anaconda)
    else:
        raise SystemError, "Could not determine system architecture."
示例#7
0
def getBootloader(anaconda):
    """Get the bootloader info object for your architecture"""
    if iutil.isX86():
        import x86

        return x86.x86BootloaderInfo(anaconda)
    elif iutil.isIA64():
        import ia64

        return ia64.ia64BootloaderInfo(anaconda)
    elif iutil.isS390():
        import s390

        return s390.s390BootloaderInfo(anaconda)
    elif iutil.isAlpha():
        import alpha

        return alpha.alphaBootloaderInfo(anaconda)
    elif iutil.isPPC():
        import ppc

        return ppc.ppcBootloaderInfo(anaconda)
    elif iutil.isSparc():
        import sparc

        return sparc.sparcBootloaderInfo(anaconda)
    else:
        return bootloaderInfo(anaconda)
示例#8
0
def restoreTime(anaconda):
    """Load time setup for upgrade install.
    
    We need to find out the timezone and the UTC parameter of the old system and
    set the system time accordingly, so timestamps are set correctly for the
    files the upgrade procedure will create.

    This is pretty much what packages.setupTimezone() does in reverse.
    """
    if anaconda.dir == DISPATCH_BACK:
        return
    if os.environ.has_key("TZ"):
        del os.environ["TZ"]
    copyFromSysimage(anaconda.rootPath, '/etc/localtime')
    copyFromSysimage(anaconda.rootPath, '/etc/adjtime')
    if iutil.isS390():
        return
    args = ["--hctosys"]
    try:
        iutil.execWithRedirect("/sbin/hwclock",
                               args,
                               stdout="/dev/tty5",
                               stderr="/dev/tty5")
    except RuntimeError:
        log.error("Failed to set the clock.")
def getPlatform(anaconda):
    """Check the architecture of the system and return an instance of a
       Platform subclass to match.  If the architecture could not be determined,
       raise an exception."""
    if iutil.isAlpha():
        return Alpha(anaconda)
    elif iutil.isIA64():
        return IA64(anaconda)
    elif iutil.isPPC():
        ppcMachine = iutil.getPPCMachine()

        if (ppcMachine == "PMac" and iutil.getPPCMacGen() == "NewWorld"):
            return NewWorldPPC(anaconda)
        elif ppcMachine in ["iSeries", "pSeries"]:
            return IPSeriesPPC(anaconda)
        elif ppcMachine == "PS3":
            return PS3(anaconda)
        else:
            raise SystemError, "Unsupported PPC machine type"
    elif iutil.isS390():
        return S390(anaconda)
    elif iutil.isSparc():
        return Sparc(anaconda)
    elif iutil.isX86():
        return X86(anaconda)
    else:
        raise SystemError, "Could not determine system architecture."
示例#10
0
def setupTimezone(anaconda):
    # we don't need this on an upgrade or going backwards
    if anaconda.upgrade or anaconda.dir == DISPATCH_BACK:
        return

    os.environ["TZ"] = anaconda.timezone.tz
    tzfile = "/usr/share/zoneinfo/" + anaconda.timezone.tz
    tzlocalfile = "/etc/localtime"
    if not os.access(tzfile, os.R_OK):
        log.error("unable to set timezone")
    else:
        try:
            os.remove(tzlocalfile)
        except OSError:
            pass
        try:
            shutil.copyfile(tzfile, tzlocalfile)
        except OSError as e:
            log.error("Error copying timezone (from %s): %s" %(tzfile, e.strerror))

    if iutil.isS390():
        return
    args = [ "--hctosys" ]
    if anaconda.timezone.utc:
        args.append("-u")

    try:
        iutil.execWithRedirect("/sbin/hwclock", args, stdin = None,
                               stdout = "/dev/tty5", stderr = "/dev/tty5")
    except RuntimeError:
        log.error("Failed to set clock")
示例#11
0
    def addDriveDialog(self, screen):
        newdrv = []
        if storage.iscsi.has_iscsi():
            newdrv.append("Add iSCSI target")
        if iutil.isS390():
            newdrv.append("Add zFCP LUN")
        if storage.fcoe.has_fcoe():
            newdrv.append("Add FCoE SAN")

        if len(newdrv) == 0:
            return INSTALL_BACK

        (button,
         choice) = ListboxChoiceWindow(screen,
                                       _("Advanced Storage Options"),
                                       _("How would you like to modify "
                                         "your drive configuration?"),
                                       newdrv,
                                       [TEXT_OK_BUTTON, TEXT_BACK_BUTTON],
                                       width=55,
                                       height=3)

        if button == TEXT_BACK_CHECK:
            return INSTALL_BACK
        if newdrv[choice] == "Add zFCP LUN":
            try:
                return self.addZFCPDriveDialog(screen)
            except ValueError, e:
                ButtonChoiceWindow(screen, _("Error"), str(e))
                return INSTALL_BACK
示例#12
0
def doReIPL(anaconda):
    if not iutil.isS390() or anaconda.dir == DISPATCH_BACK:
        return DISPATCH_NOOP

    anaconda.reIPLMessage = iutil.reIPL(anaconda, os.getppid())

    return DISPATCH_FORWARD
示例#13
0
    def addDriveDialog(self, screen):
        newdrv = []
        if storage.iscsi.has_iscsi():
            if storage.iscsi.iscsi().mode == "none":
                newdrv.append("Add iSCSI target")
                newdrv.append("Add iSCSI target - use interface binding")
            elif storage.iscsi.iscsi().mode == "bind":
                newdrv.append("Add iSCSI target - use interface binding")
            elif storage.iscsi.iscsi().mode == "default":
                newdrv.append("Add iSCSI target")

        if iutil.isS390():
            newdrv.append( "Add zFCP LUN" )
        if storage.fcoe.has_fcoe():
            newdrv.append("Add FCoE SAN")

        if len(newdrv) == 0:
            return INSTALL_BACK

        (button, choice) = ListboxChoiceWindow(screen,
                                   _("Advanced Storage Options"),
                                   _("How would you like to modify "
                                     "your drive configuration?"),
                                   newdrv,
                                   [ TEXT_OK_BUTTON, TEXT_BACK_BUTTON],
                                               width=55, height=3)
        
        if button == TEXT_BACK_CHECK:
            return INSTALL_BACK
        if newdrv[choice] == "Add zFCP LUN":
            try:
                return self.addZFCPDriveDialog(screen)
            except ValueError, e:
                ButtonChoiceWindow(screen, _("Error"), str(e))
                return INSTALL_BACK
示例#14
0
    def __init__(self):
        self.tty_loglevel = DEFAULT_TTY_LEVEL
        self.remote_syslog = None
        # Rename the loglevels so they are the same as in syslog.
        logging.addLevelName(logging.WARNING, "WARN")
        logging.addLevelName(logging.ERROR, "ERR")
        logging.addLevelName(logging.CRITICAL, "CRIT")

        # Create the base of the logger hierarchy.
        anaconda_logger = logging.getLogger("anaconda")
        self.addFileHandler(MAIN_LOG_FILE,
                            anaconda_logger,
                            minLevel=logging.DEBUG)

        # Create the storage logger.
        storage_logger = logging.getLogger("storage")
        self.addFileHandler(STORAGE_LOG_FILE,
                            storage_logger,
                            minLevel=logging.DEBUG)

        # Set the common parameters for anaconda and storage loggers.
        for logger in [anaconda_logger, storage_logger]:
            logger.setLevel(logging.DEBUG)
            self.forwardToSyslog(logger)
            # Logging of basic stuff and storage to tty3.
            if not iutil.isS390() and os.access(MAIN_LOG_TTY, os.W_OK):
                self.addFileHandler(MAIN_LOG_TTY,
                                    logger,
                                    fmtStr=TTY_FORMAT,
                                    autoLevel=True)

        # External program output log
        program_logger = logging.getLogger("program")
        program_logger.setLevel(logging.DEBUG)
        self.addFileHandler(PROGRAM_LOG_FILE,
                            program_logger,
                            minLevel=logging.DEBUG)
        self.forwardToSyslog(program_logger)

        # Create a second logger for just the stuff we want to dup on
        # stdout.  Anything written here will also get passed up to the
        # parent loggers for processing and possibly be written to the
        # log.
        stdoutLogger = logging.getLogger("anaconda.stdout")
        stdoutLogger.setLevel(logging.INFO)
        # Add a handler for the duped stuff.  No fancy formatting, thanks.
        self.addFileHandler(sys.stdout,
                            stdoutLogger,
                            fmtStr=STDOUT_FORMAT,
                            minLevel=logging.INFO)

        # Stderr logger
        stderrLogger = logging.getLogger("anaconda.stderr")
        stderrLogger.setLevel(logging.INFO)
        self.addFileHandler(sys.stderr,
                            stderrLogger,
                            fmtStr=STDOUT_FORMAT,
                            minLevel=logging.INFO)
示例#15
0
    def firstboot(self):
        from pykickstart.constants import FIRSTBOOT_SKIP, FIRSTBOOT_DEFAULT

        if self.ksdata:
            return self.ksdata.firstboot.firstboot
        elif iutil.isS390():
            return FIRSTBOOT_SKIP
        else:
            return FIRSTBOOT_DEFAULT
    def firstboot(self):
        from pykickstart.constants import FIRSTBOOT_SKIP, FIRSTBOOT_DEFAULT

        if self.ksdata:
            return self.ksdata.firstboot.firstboot
        elif iutil.isS390():
            return FIRSTBOOT_SKIP
        else:
            return FIRSTBOOT_DEFAULT
示例#17
0
    def __init__ (self):
        self.tty_loglevel = DEFAULT_TTY_LEVEL
        self.remote_syslog = None
        # Rename the loglevels so they are the same as in syslog.
        logging.addLevelName(logging.WARNING, "WARN")
        logging.addLevelName(logging.ERROR, "ERR")
        logging.addLevelName(logging.CRITICAL, "CRIT")

        # Create the base of the logger hierarchy.
        self.anaconda_logger = logging.getLogger("anaconda")
        self.addFileHandler(MAIN_LOG_FILE, self.anaconda_logger,
                            minLevel=logging.DEBUG)
        warnings.showwarning = self.showwarning

        # Create the storage logger.
        storage_logger = logging.getLogger("storage")
        self.addFileHandler(STORAGE_LOG_FILE, storage_logger,
                            minLevel=logging.DEBUG)

        # Set the common parameters for anaconda and storage loggers.
        for logger in [self.anaconda_logger, storage_logger]:
            logger.setLevel(logging.DEBUG)
            self.forwardToSyslog(logger)
            # Logging of basic stuff and storage to tty3.
            if not iutil.isS390() and os.access(MAIN_LOG_TTY, os.W_OK):
                self.addFileHandler(MAIN_LOG_TTY, logger,
                                    fmtStr=TTY_FORMAT,
                                    autoLevel=True)

        # External program output log
        program_logger = logging.getLogger("program")
        program_logger.setLevel(logging.DEBUG)
        self.addFileHandler(PROGRAM_LOG_FILE, program_logger,
                            minLevel=logging.DEBUG)
        self.forwardToSyslog(program_logger)

        # Create a second logger for just the stuff we want to dup on
        # stdout.  Anything written here will also get passed up to the
        # parent loggers for processing and possibly be written to the
        # log.
        stdoutLogger = logging.getLogger("anaconda.stdout")
        stdoutLogger.setLevel(logging.INFO)
        # Add a handler for the duped stuff.  No fancy formatting, thanks.
        self.addFileHandler(sys.stdout, stdoutLogger,
                            fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)

        # Stderr logger
        stderrLogger = logging.getLogger("anaconda.stderr")
        stderrLogger.setLevel(logging.INFO)
        self.addFileHandler(sys.stderr, stderrLogger,
                            fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)
示例#18
0
    def __init__(self):
        import desktop, dispatch, firewall, security
        import system_config_keyboard.keyboard as keyboard
        from flags import flags

        self._backend = None
        self._bootloader = None
        self.canReIPL = False
        self.desktop = desktop.Desktop()
        self.dir = None
        self.dispatch = dispatch.Dispatcher(self)
        self.displayMode = None
        self.extraModules = []
        self.firewall = firewall.Firewall()
        self.id = None
        self._instClass = None
        self._instLanguage = None
        self._intf = None
        self.isHeadless = False
        self.keyboard = keyboard.Keyboard()
        self.ksdata = None
        self.mediaDevice = None
        self.methodstr = None
        self._network = None
        self.opts = None
        self._platform = None
        self.proxy = None
        self.proxyUsername = None
        self.proxyPassword = None
        self.reIPLMessage = None
        self.rescue = False
        self.rescue_mount = True
        self.rootParts = None
        self.rootPath = "/mnt/sysimage"
        self.security = security.Security()
        self.simpleFilter = not iutil.isS390()
        self.stage2 = None
        self._storage = None
        self._timezone = None
        self.updateSrc = None
        self.upgrade = flags.cmdline.has_key("preupgrade")
        self.upgradeRoot = None
        self.upgradeSwapInfo = None
        self._users = None
        self.mehConfig = None
        self.clearPartTypeSelection = None      # User's GUI selection
        self.clearPartTypeSystem = None         # System's selection

        # *sigh* we still need to be able to write this out
        self.xdriver = None
    def __init__(self):
        import desktop, dispatch, firewall, security
        import system_config_keyboard.keyboard as keyboard
        from flags import flags

        self._backend = None
        self._bootloader = None
        self.canReIPL = False
        self.desktop = desktop.Desktop()
        self.dir = None
        self.dispatch = dispatch.Dispatcher(self)
        self.displayMode = None
        self.extraModules = []
        self.firewall = firewall.Firewall()
        self.id = None
        self._instClass = None
        self._instLanguage = None
        self._intf = None
        self.isHeadless = False
        self.keyboard = keyboard.Keyboard()
        self.ksdata = None
        self.mediaDevice = None
        self.methodstr = None
        self._network = None
        self.opts = None
        self._platform = None
        self.proxy = None
        self.proxyUsername = None
        self.proxyPassword = None
        self.reIPLMessage = None
        self.rescue = False
        self.rescue_mount = True
        self.rootParts = None
        self.rootPath = "/mnt/sysimage"
        self.security = security.Security()
        self.simpleFilter = not iutil.isS390()
        self.stage2 = None
        self._storage = None
        self._timezone = None
        self.updateSrc = None
        self.upgrade = flags.cmdline.has_key("preupgrade")
        self.upgradeRoot = None
        self.upgradeSwapInfo = None
        self._users = None
        self.mehConfig = None
        self.clearPartTypeSelection = None      # User's GUI selection
        self.clearPartTypeSystem = None         # System's selection

        # *sigh* we still need to be able to write this out
        self.xdriver = None
示例#20
0
    def __str__(self):
        s = ""
        keys = self.info.keys()
        if iutil.isS390() and ("HWADDR" in keys):
            keys.remove("HWADDR")
        # make sure we include autoneg in the ethtool line
        if 'ETHTOOL_OPTS' in keys:
            eopts = self.get('ETHTOOL_OPTS')
            if "autoneg" not in eopts:
                self.set(('ETHTOOL_OPTS', "autoneg off %s" % eopts))

        for key in keys:
            if self.info[key] is not None:
                s = s + key + '="' + self.info[key] + '"\n'

        return s
示例#21
0
    def __str__(self):
        s = ""
        keys = self.info.keys()
        if iutil.isS390() and ("HWADDR" in keys):
            keys.remove("HWADDR")
        # make sure we include autoneg in the ethtool line
        if 'ETHTOOL_OPTS' in keys:
            eopts = self.get('ETHTOOL_OPTS')
            if "autoneg" not in eopts:
                self.set(('ETHTOOL_OPTS', "autoneg off %s" % eopts))

        for key in keys:
            if self.info[key] is not None:
                s = s + key + '="' + self.info[key] + '"\n'

        return s
示例#22
0
    def __init__(self, anaconda, extraModules, displayMode, backend = None):
        self.displayMode = displayMode

        self.instLanguage = language.Language(self.displayMode)
        self.keyboard = keyboard.Keyboard()
        self.backend = backend
        self.anaconda = anaconda

        self.monitor = None
        self.videocard = None
        self.isHeadless = 0
        self.extraModules = extraModules

        self.simpleFilter = not iutil.isS390()

        self.reset()
示例#23
0
    def __init__(self, anaconda, extraModules, displayMode, backend=None):
        self.displayMode = displayMode

        self.instLanguage = language.Language(self.displayMode)
        self.keyboard = keyboard.Keyboard()
        self.backend = backend
        self.anaconda = anaconda

        self.monitor = None
        self.videocard = None
        self.isHeadless = 0
        self.extraModules = extraModules

        self.simpleFilter = not iutil.isS390()

        self.reset()
def setSteps(anaconda):
    dispatch = anaconda.dispatch
    dispatch.setStepList(
        "language", "keyboard", "welcome", "filtertype", "filter",
        "installtype", "storageinit", "findrootparts", "findinstall",
        "upgrademount", "upgrademigfind", "upgrademigratefs",
        "enablefilesystems", "upgradecontinue", "reposetup", "upgbootloader",
        "checkdeps", "dependencies", "confirmupgrade", "postselection",
        "reipl", "install", "preinstallconfig", "installpackages",
        "postinstallconfig", "instbootloader", "dopostaction",
        "methodcomplete", "postscripts", "copylogs", "complete")

    if not iutil.isX86() and not iutil.isS390():
        dispatch.skipStep("bootloader")
        dispatch.skipStep("upgbootloader")

    dispatch.skipStep("cleardiskssel", permanent=1)
示例#25
0
def addDrive(anaconda):
    (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
    gui.addFrame(dialog)
    dialog.show_all()
    if not iutil.isS390():
        dxml.get_widget("zfcpRadio").hide()
        dxml.get_widget("zfcpRadio").set_group(None)

    if not storage.iscsi.has_iscsi():
        dxml.get_widget("iscsiRadio").set_sensitive(False)
        dxml.get_widget("iscsiRadio").set_active(False)

    if not storage.fcoe.has_fcoe():
        dxml.get_widget("fcoeRadio").set_sensitive(False)
        dxml.get_widget("fcoeRadio").set_active(False)

    #figure out what advanced devices we have available and set sensible default
    group = dxml.get_widget("iscsiRadio").get_group()
    for button in group:
        if button is not None and button.get_property("sensitive"):
            button.set_active(True)
            button.grab_focus()
            break

    rc = dialog.run()
    dialog.hide()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False

    if dxml.get_widget(
            "iscsiRadio").get_active() and storage.iscsi.has_iscsi():
        rc = addIscsiDrive(anaconda)
    elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe():
        rc = addFcoeDrive(anaconda)
    elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget(
            "zfcpRadio").get_active():
        rc = addZfcpDrive(anaconda)

    dialog.destroy()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False
    else:
        return True
示例#26
0
def doReIPL(anaconda):
    #   # This is here as an example to fix the screen during the TUI debugging path
    #   anaconda.intf.screen.suspend ()
    #   import pdb
    #   pdb.set_trace ()

    if not iutil.isS390() or anaconda.dir == DISPATCH_BACK:
        return DISPATCH_NOOP

    messageInfo = iutil.reIPL(anaconda, os.getppid())

    if messageInfo:
        (errorMessage, rebootInstr) = messageInfo

        # errorMessage intentionally not shown in UI
        anaconda.reIPLMessage = rebootInstr

    return DISPATCH_FORWARD
示例#27
0
def doReIPL(anaconda):
#   # This is here as an example to fix the screen during the TUI debugging path
#   anaconda.intf.screen.suspend ()
#   import pdb
#   pdb.set_trace ()

    if not iutil.isS390() or anaconda.dir == DISPATCH_BACK:
        return DISPATCH_NOOP

    messageInfo = iutil.reIPL(anaconda, os.getppid())

    if messageInfo:
        (errorMessage, rebootInstr) = messageInfo

        # errorMessage intentionally not shown in UI
        anaconda.reIPLMessage = rebootInstr

    return DISPATCH_FORWARD
示例#28
0
def setSteps(anaconda):
    dispatch = anaconda.dispatch
    dispatch.setStepList(
                "language",
                "keyboard",
                "languageNext",
                "welcome",
                "filtertype",
                "filter",
                "installtype",
                "storageinit",
                "findrootparts",
                "findinstall",
                "upgrademount",
                "upgrademigfind",
                "upgrademigratefs",
                "enablefilesystems",
                "upgradecontinue",
                "reposetup",
                "upgbootloader",
                "checkdeps",
                "dependencies",
                "confirmupgrade",
                "postselection",
                "reipl",
                "install",
                "preinstallconfig",
                "installpackages",
                "postinstallconfig",
                "instbootloader",
                "dopostaction",
                "methodcomplete",
                "postscripts",
                "copylogs",
                "complete"
            )

    if not iutil.isX86() and not iutil.isS390():
        dispatch.skipStep("bootloader")
        dispatch.skipStep("upgbootloader")

    dispatch.skipStep("cleardiskssel", permanent=1)
示例#29
0
    def __init__(self):
        self.tty_loglevel = DEFAULT_TTY_LEVEL
        self.remote_syslog = None
        # Create the base of the logger hierarcy.
        logger = logging.getLogger("anaconda")
        logger.setLevel(logging.DEBUG)
        self.addFileHandler(MAIN_LOG_FILE, logger, minLevel=logging.DEBUG)
        self.forwardToSyslog(logger)
        # Log to tty3.
        if not iutil.isS390() and os.access(MAIN_LOG_TTY, os.W_OK):
            self.addFileHandler(MAIN_LOG_TTY,
                                logger,
                                fmtStr=TTY_FORMAT,
                                autoLevel=True)

        # External program output log
        program_logger = logging.getLogger("program")
        program_logger.setLevel(logging.DEBUG)
        self.addFileHandler(PROGRAM_LOG_FILE,
                            program_logger,
                            minLevel=logging.DEBUG)
        self.forwardToSyslog(program_logger)

        # Create a second logger for just the stuff we want to dup on
        # stdout.  Anything written here will also get passed up to the
        # parent loggers for processing and possibly be written to the
        # log.
        stdoutLogger = logging.getLogger("anaconda.stdout")
        stdoutLogger.setLevel(logging.INFO)
        # Add a handler for the duped stuff.  No fancy formatting, thanks.
        self.addFileHandler(sys.stdout,
                            stdoutLogger,
                            fmtStr=STDOUT_FORMAT,
                            minLevel=logging.INFO)

        # Stderr logger
        stderrLogger = logging.getLogger("anaconda.stderr")
        stderrLogger.setLevel(logging.INFO)
        self.addFileHandler(sys.stderr,
                            stderrLogger,
                            fmtStr=STDOUT_FORMAT,
                            minLevel=logging.INFO)
示例#30
0
def addDrive(anaconda):
    (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
    gui.addFrame(dialog)
    dialog.show_all()
    if not iutil.isS390():
        dxml.get_widget("zfcpRadio").hide()
        dxml.get_widget("zfcpRadio").set_group(None)

    if not storage.iscsi.has_iscsi():
        dxml.get_widget("iscsiRadio").set_sensitive(False)
        dxml.get_widget("iscsiRadio").set_active(False)

    if not storage.fcoe.has_fcoe():
        dxml.get_widget("fcoeRadio").set_sensitive(False)
        dxml.get_widget("fcoeRadio").set_active(False)

    #figure out what advanced devices we have available and set sensible default
    group = dxml.get_widget("iscsiRadio").get_group()
    for button in group:
        if button is not None and button.get_property("sensitive"):
            button.set_active(True)
            break

    rc = dialog.run()
    dialog.hide()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False

    if dxml.get_widget("iscsiRadio").get_active() and storage.iscsi.has_iscsi():
        rc = addIscsiDrive(anaconda)
    elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe():
        rc = addFcoeDrive(anaconda)
    elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active():
        rc = addZfcpDrive(anaconda)

    dialog.destroy()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False
    else:
        return True
示例#31
0
def getBootloader(anaconda):
    """Get the bootloader info object for your architecture"""
    if iutil.isX86():
        import x86
        return x86.x86BootloaderInfo(anaconda)
    elif iutil.isIA64():
        import ia64
        return ia64.ia64BootloaderInfo(anaconda)
    elif iutil.isS390():
        import s390
        return s390.s390BootloaderInfo(anaconda)
    elif iutil.isAlpha():
        import alpha
        return alpha.alphaBootloaderInfo(anaconda)
    elif iutil.isPPC():
        import ppc
        return ppc.ppcBootloaderInfo(anaconda)
    elif iutil.isSparc():
        import sparc
        return sparc.sparcBootloaderInfo(anaconda)
    else:
        return bootloaderInfo(anaconda)
示例#32
0
def restoreTime(anaconda):
    """Load time setup for upgrade install.
    
    We need to find out the timezone and the UTC parameter of the old system and
    set the system time accordingly, so timestamps are set correctly for the
    files the upgrade procedure will create.

    This is pretty much what packages.setupTimezone() does in reverse.
    """
    if anaconda.dir == DISPATCH_BACK:
        return
    if os.environ.has_key("TZ"):
        del os.environ["TZ"]
    copyFromSysimage(anaconda.rootPath, '/etc/localtime')
    copyFromSysimage(anaconda.rootPath, '/etc/adjtime')
    if iutil.isS390():
        return
    args = [ "--hctosys" ]
    try:
        iutil.execWithRedirect("/sbin/hwclock", args,stdout = "/dev/tty5",
                               stderr = "/dev/tty5")
    except RuntimeError:
        log.error("Failed to set the clock.")
示例#33
0
    def __init__ (self):
        self.tty_loglevel = DEFAULT_TTY_LEVEL
        self.remote_syslog = None
        # Create the base of the logger hierarcy.
        logger = logging.getLogger("anaconda")
        logger.setLevel(logging.DEBUG)
        self.addFileHandler(MAIN_LOG_FILE, logger,
                            minLevel=logging.DEBUG)
        self.forwardToSyslog(logger)
        # Log to tty3.
        if not iutil.isS390() and os.access(MAIN_LOG_TTY, os.W_OK):
            self.addFileHandler(MAIN_LOG_TTY, logger,
                                fmtStr=TTY_FORMAT,
                                autoLevel=True)

        # External program output log
        program_logger = logging.getLogger("program")
        program_logger.setLevel(logging.DEBUG)
        self.addFileHandler(PROGRAM_LOG_FILE, program_logger,
                            minLevel=logging.DEBUG)
        self.forwardToSyslog(program_logger)

        # Create a second logger for just the stuff we want to dup on
        # stdout.  Anything written here will also get passed up to the
        # parent loggers for processing and possibly be written to the
        # log.
        stdoutLogger = logging.getLogger("anaconda.stdout")
        stdoutLogger.setLevel(logging.INFO)
        # Add a handler for the duped stuff.  No fancy formatting, thanks.
        self.addFileHandler(sys.stdout, stdoutLogger,
                            fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)

        # Stderr logger
        stderrLogger = logging.getLogger("anaconda.stderr")
        stderrLogger.setLevel(logging.INFO)
        self.addFileHandler(sys.stderr, stderrLogger,
                            fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)
示例#34
0
    def dracutSetupString(self, networkStorageDevice):
        netargs=""

        if networkStorageDevice.nic:
            # Storage bound to a specific nic (ie FCoE)
            nic = networkStorageDevice.nic
        else:
            # Storage bound through ip, find out which interface leads to host
            host = networkStorageDevice.host_address
            route = iutil.execWithCapture("ip", [ "route", "get", "to", host ])
            if not route:
                log.error("Could net get interface for route to %s" % host)
                return ""

            routeInfo = route.split()
            if routeInfo[0] != host or len(routeInfo) < 5 or \
               "dev" not in routeInfo or routeInfo.index("dev") > 3:
                log.error('Unexpected "ip route get to %s" reply: %s' %
                          (host, routeInfo))
                return ""

            nic = routeInfo[routeInfo.index("dev") + 1]

        if nic not in self.netdevices.keys():
            log.error('Unknown network interface: %s' % nic)
            return ""

        dev = self.netdevices[nic]

        if networkStorageDevice.host_address:
            if dev.get('bootproto').lower() == 'dhcp':
                netargs += "ip=%s:dhcp" % nic
            else:
                if dev.get('GATEWAY'):
                    gateway = dev.get('GATEWAY')
                else:
                    gateway = ""

                if self.hostname:
                    hostname = self.hostname
                else:
                    hostname = ""

                netargs += "ip=%s::%s:%s:%s:%s:none" % (dev.get('ipaddr'),
                           gateway, dev.get('netmask'), hostname, nic)

        hwaddr = dev.get("HWADDR")
        if hwaddr:
            if netargs != "":
                netargs += " "

            netargs += "ifname=%s:%s" % (nic, hwaddr.lower())

        nettype = dev.get("NETTYPE")
        subchannels = dev.get("SUBCHANNELS")
        if iutil.isS390() and nettype and subchannels:
            if netargs != "":
                netargs += " "

            netargs += "rd_CCW=%s,%s" % (nettype, subchannels)

            options = dev.get("OPTIONS")
            if options:
                options = filter(lambda x: x != '', options.split(' '))
                netargs += ",%s" % (','.join(options))

        return netargs
示例#35
0
    from baseudev import udev_trigger, udev_settle
    udev_trigger("net")
    udev_trigger("block") # trigger the block subsys too while at it
    udev_settle()
    # and for added fun, once doesn't seem to be enough?  so we 
    # do it twice, it works and we scream at the world "OH WHY?"
    udev_trigger("net")
    udev_settle()

    import gettext
    _ = lambda x: gettext.ldgettext("anaconda", x)

    import platform
    anaconda.platform = platform.getPlatform(anaconda)

    if not iutil.isS390() and os.access("/dev/tty3", os.W_OK):
        anaconda_log.logger.addFileHandler ("/dev/tty3", log)

    warnings.showwarning = AnacondaShowWarning

    iutil.setup_translations(gettext)

    # reset python's default SIGINT handler
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    signal.signal(signal.SIGSEGV, isys.handleSegv)

    setupEnvironment()
    # make sure we have /var/log soon, some programs fail to start without it
    iutil.mkdirChain("/var/log")

    pidfile = open("/var/run/anaconda.pid", "w")
示例#36
0
def addDrive(anaconda):
    (dxml, dialog) = gui.getGladeWidget("adddrive.glade", "addDriveDialog")
    gui.addFrame(dialog)
    dialog.show_all()
    if not iutil.isS390():
        dxml.get_widget("zfcpRadio").hide()
        dxml.get_widget("zfcpRadio").set_group(None)

    if not storage.iscsi.has_iscsi():
        dxml.get_widget("iscsiRadio").set_sensitive(False)
        dxml.get_widget("iscsiRadio").set_active(False)

    if not storage.fcoe.has_fcoe():
        dxml.get_widget("fcoeRadio").set_sensitive(False)
        dxml.get_widget("fcoeRadio").set_active(False)
    # liuweifeng
    elif storage.iscsi.has_iscsi():
        dxml.get_widget("fcoeRadio").set_active(False)
        dxml.get_widget("iscsiRadio").set_sensitive(True)
        dxml.get_widget("iscsiRadio").set_active(True)
    #figure out what advanced devices we have available and set sensible default
    group = dxml.get_widget("iscsiRadio").get_group()
    for button in group:
        if button is not None and button.get_property("sensitive"):
            button.set_active(True)
            button.grab_focus()
            break
        
    # 
    for button in group:
        if button is not None and button.get_property("sensitive"):
            label = button.get_property("label")
            if "_" in label:
                nl = ""
                for s in label.split('_'):
                    nl = nl+s
                button.set_property("label",nl)
                
    cancelButton = dxml.get_widget("cancelButton")
    cancelButton.set_property("label",_("Cancel"))
    
    okButtonl = dxml.get_widget("label2")
    label = okButtonl.get_property("label")
    if '(_A)' in label:
        i = label.index('(_A)')
        nl = label[0:i]+label[i+4:]
        okButtonl.set_property("label",_(nl))
    
    #liuweifeng
    dxml.get_widget("fcoeRadio").set_active(False)
    #dxml.get_widget("fcoeRadio").set_property("focus_on_click",False)
    dxml.get_widget("iscsiRadio").set_sensitive(True)
    dxml.get_widget("iscsiRadio").set_active(True)
    dxml.get_widget("iscsiRadio").grab_focus()
    
    rc = dialog.run()
    dialog.hide()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False

    if dxml.get_widget("iscsiRadio").get_active() and storage.iscsi.has_iscsi():
        rc = addIscsiDrive(anaconda)
    elif dxml.get_widget("fcoeRadio").get_active() and storage.fcoe.has_fcoe():
        rc = addFcoeDrive(anaconda)
    elif dxml.get_widget("zfcpRadio") is not None and dxml.get_widget("zfcpRadio").get_active():
        rc = addZfcpDrive(anaconda)

    dialog.destroy()

    if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
        return False
    else:
        return True
示例#37
0
    def startup(self, intf, exclusiveDisks, zeroMbr, cdl):
        """ Look for any unformatted DASDs in the system and offer the user
            the option for format them with dasdfmt or exit the installer.

            Also check if any DASDs are LDL formatted and show a warning to
            users, since these disks will not be usable during installation.
        """
        if self.started:
            return

        self.started = True

        if not iutil.isS390():
            return

        # Trigger udev data about the dasd devices on the system
        udev_trigger(action="change", name="dasd*")

        log.info("Checking for unformatted and LDL DASD devices:")

        for device in os.listdir("/sys/block"):
            if not device.startswith("dasd"):
                continue

            statusfile = "/sys/block/%s/device/status" % (device, )
            if not os.path.isfile(statusfile):
                continue

            f = open(statusfile, "r")
            status = f.read().strip()
            f.close()

            bypath = deviceNameToDiskByPath(device)
            if not bypath:
                bypath = "/dev/" + device

            if status in ["unformatted"] and device not in exclusiveDisks:
                log.info("    %s (%s) status is %s, needs dasdfmt" % (
                    device,
                    bypath,
                    status,
                ))
                self._dasdlist.append((device, bypath))

            elif isys.isLdlDasd(device):
                log.info("     %s (%s) is an LDL DASD, needs dasdfmt" %
                         (device, bypath))
                self._ldldasdlist.append((device, bypath))

        if not intf and (not zeroMbr or not cdl):
            log.info("    non-interactive kickstart install without zerombr "
                     "or clearpart --cdl "
                     "command, unable to run dasdfmt, exiting installer")
            sys.exit(0)

        # now onto formatting our DASDs
        if not len(self._dasdlist):
            log.info("    no unformatted DASD devices found")
        else:
            self.format_dasds(intf, not zeroMbr, self._dasdlist)

        if not len(self._ldldasdlist):
            log.info("    no LDL DASD devices found")
        else:
            self.format_dasds(intf, not cdl, self._ldldasdlist)
示例#38
0
    from baseudev import udev_trigger, udev_settle
    udev_trigger("net")
    udev_trigger("block")  # trigger the block subsys too while at it
    udev_settle()
    # and for added fun, once doesn't seem to be enough?  so we
    # do it twice, it works and we scream at the world "OH WHY?"
    udev_trigger("net")
    udev_settle()

    import gettext
    _ = lambda x: gettext.ldgettext("anaconda", x)

    import platform
    anaconda.platform = platform.getPlatform(anaconda)

    if not iutil.isS390() and os.access("/dev/tty3", os.W_OK):
        anaconda_log.logger.addFileHandler("/dev/tty3", log)

    warnings.showwarning = AnacondaShowWarning

    iutil.setup_translations(gettext)

    # reset python's default SIGINT handler
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    signal.signal(signal.SIGSEGV, isys.handleSegv)

    setupEnvironment()
    # make sure we have /var/log soon, some programs fail to start without it
    iutil.mkdirChain("/var/log")

    pidfile = open("/var/run/anaconda.pid", "w")
示例#39
0
    def startup(self, *args, **kwargs):
        """ Look for any unformatted DASDs in the system and offer the user
            the option for format them with dasdfmt or exit the installer.
        """
        if self.started:
            return

        self.started = True

        if not iutil.isS390():
            return

        intf = kwargs.get("intf")
        zeroMbr = kwargs.get("zeroMbr")

        log.info("Checking for unformatted DASD devices:")

        for device in os.listdir("/sys/block"):
            if not device.startswith("dasd"):
                continue

            statusfile = "/sys/block/%s/device/status" % (device, )
            if not os.path.isfile(statusfile):
                continue

            f = open(statusfile, "r")
            status = f.read().strip()
            f.close()

            if status == "unformatted":
                log.info("    %s is an unformatted DASD" % (device, ))
                self._dasdlist.append(device)

        if not len(self._dasdlist):
            log.info("    no unformatted DASD devices found")
            return

        askUser = True

        if zeroMbr:
            askUser = False
        elif not intf and not zeroMbr:
            log.info("    non-interactive kickstart install without zerombr "
                     "command, unable to run dasdfmt, exiting installer")
            sys.exit(0)

        tmplist = map(lambda s: "/dev/" + s, self._dasdlist)
        self._dasdlist = map(lambda s: deviceNameToDiskByPath(s), tmplist)
        c = len(self._dasdlist)

        if intf and askUser:
            title = P_("Unformatted DASD Device Found",
                       "Unformatted DASD Devices Found", c)
            msg = P_(
                "Format uninitialized DASD device?\n\n"
                "There is %d uninitialized DASD device on this "
                "system.  To continue installation, the device must "
                "be formatted.  Formatting will remove any data on "
                "this device." % c, "Format uninitialized DASD devices?\n\n"
                "There are %d uninitialized DASD devices on this "
                "system.  To continue installation, the devices must "
                "be formatted.  Formatting will remove any data on "
                "these devices." % c, c)

            devs = ''
            for dasd in self._dasdlist:
                devs += "%s\n" % (dasd, )

            icon = "/usr/share/icons/gnome/32x32/status/dialog-error.png"
            buttons = [_("_Format"), _("_Exit installer")]
            rc = intf.detailedMessageWindow(title,
                                            msg,
                                            devs.strip(),
                                            type="custom",
                                            custom_icon=icon,
                                            custom_buttons=buttons)
            if rc == 1:
                log.info("    not running dasdfmt, exiting installer")
                sys.exit(0)

        argv = ["-y", "-P", "-d", "cdl", "-b", "4096"]

        if intf:
            title = P_("Formatting DASD Device", "Formatting DASD Devices", c)
            msg = P_("Preparing %d DASD device for use with Linux..." % c,
                     "Preparing %d DASD devices for use with Linux..." % c, c)
            pw = intf.progressWindow(title, msg, 1.0)

            for dasd in self._dasdlist:
                log.info("Running dasdfmt on %s" % (dasd, ))
                iutil.execWithCallback("/sbin/dasdfmt",
                                       argv + [dasd],
                                       stdout="/dev/tty5",
                                       stderr="/dev/tty5",
                                       callback=self._updateProgressWindow,
                                       callback_data=pw,
                                       echo=False)

            pw.pop()
        else:
            for dasd in self._dasdlist:
                log.info("Running dasdfmt on %s" % (dasd, ))
                iutil.execWithRedirect("/sbin/dasdfmt",
                                       argv + [dasd],
                                       stdout="/dev/tty5",
                                       stderr="/dev/tty5")
示例#40
0
 def unsupported_steps(self):
     l = ["cleardiskssel", "filtertype", "filter", "group-selection",
          "partition"]
     if not iutil.isS390():
         l.append("bootloader")
     return l
示例#41
0
def vtActivate (num):
    if iutil.isS390():
        return
    _isys.vtActivate (num)
示例#42
0
    from baseudev import udev_trigger, udev_settle
    udev_trigger("net")
    udev_trigger("block") # trigger the block subsys too while at it
    udev_settle()
    # and for added fun, once doesn't seem to be enough?  so we 
    # do it twice, it works and we scream at the world "OH WHY?"
    udev_trigger("net")
    udev_settle()

    import gettext
    _ = lambda x: gettext.ldgettext("anaconda", x)

    import platform
    anaconda.platform = platform.getPlatform(anaconda)

    if not iutil.isS390() and os.access("/dev/tty3", os.W_OK):
        anaconda_log.logger.addFileHandler ("/dev/tty3", log)

    warnings.showwarning = AnacondaShowWarning

    iutil.setup_translations(gettext)

    # reset python's default SIGINT handler
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    signal.signal(signal.SIGSEGV, isys.handleSegv)

    setupEnvironment()
    # make sure we have /var/log soon, some programs fail to start without it
    iutil.mkdirChain("/var/log")

    pidfile = open("/var/run/anaconda.pid", "w")
    "keyboard": ("keyboard_text", "KeyboardWindow"),
    "parttype": ("partition_text", "PartitionTypeWindow"),
    "addswap": ("upgrade_text", "UpgradeSwapWindow"),
    "upgrademigratefs": ("upgrade_text", "UpgradeMigrateFSWindow"),
    "zfcpconfig": ("zfcp_text", "ZFCPWindow"),
    "findinstall": ("upgrade_text", "UpgradeExamineWindow"),
    "upgbootloader": ("upgrade_bootloader_text", "UpgradeBootloaderWindow"),
    "network": ("network_text", "HostnameWindow"),
    "timezone": ("timezone_text", "TimezoneWindow"),
    "accounts": ("userauth_text", "RootPasswordWindow"),
    "tasksel": ("task_text", "TaskWindow"),
    "install": ("progress_text", "setupForInstall"),
    "complete": ("complete_text", "FinishedWindow"),
}

if iutil.isS390():
    stepToClasses["bootloader"] = ("zipl_text", ("ZiplWindow"))


class InstallWindow:
    def __call__(self, screen):
        raise RuntimeError, "Unimplemented screen"


class WaitWindow:
    def pop(self):
        self.screen.popWindow()
        self.screen.refresh()

    def refresh(self):
        pass
示例#44
0
    def startup(self, *args, **kwargs):
        """ Look for any unformatted DASDs in the system and offer the user
            the option for format them with dasdfmt or exit the installer.
        """
        if self.started:
            return

        self.started = True

        if not iutil.isS390():
            return

        intf = kwargs.get("intf")
        zeroMbr = kwargs.get("zeroMbr")

        log.info("Checking for unformatted DASD devices:")

        for device in os.listdir("/sys/block"):
            if not device.startswith("dasd"):
                continue

            statusfile = "/sys/block/%s/device/status" % (device,)
            if not os.path.isfile(statusfile):
                continue

            f = open(statusfile, "r")
            status = f.read().strip()
            f.close()

            if status == "unformatted":
                log.info("    %s is an unformatted DASD" % (device,))
                self._dasdlist.append(device)

        if not len(self._dasdlist):
            log.info("    no unformatted DASD devices found")
            return

        askUser = True

        if zeroMbr:
            askUser = False
        elif not intf and not zeroMbr:
            log.info("    non-interactive kickstart install without zerombr "
                     "command, unable to run dasdfmt, exiting installer")
            sys.exit(0)

        tmplist = map(lambda s: "/dev/" + s, self._dasdlist)
        self._dasdlist = map(lambda s: deviceNameToDiskByPath(s), tmplist)
        c = len(self._dasdlist)

        if intf and askUser:
            title = P_("Unformatted DASD Device Found",
                       "Unformatted DASD Devices Found", c)
            msg = P_("Format uninitialized DASD device?\n\n"
                     "There is %d uninitialized DASD device on this "
                     "system.  To continue installation, the device must "
                     "be formatted.  Formatting will remove any data on "
                     "this device." % c,
                     "Format uninitialized DASD devices?\n\n"
                     "There are %d uninitialized DASD devices on this "
                     "system.  To continue installation, the devices must "
                     "be formatted.  Formatting will remove any data on "
                     "these devices." % c,
                     c)

            devs = ''
            for dasd in self._dasdlist:
                devs += "%s\n" % (dasd,)

            icon = "/usr/share/icons/gnome/32x32/status/dialog-error.png"
            buttons = [_("_Format"), _("_Exit installer")]
            rc = intf.detailedMessageWindow(title, msg, devs.strip(),
                                                 type="custom",
                                                 custom_icon=icon,
                                                 custom_buttons=buttons)
            if rc == 1:
                log.info("    not running dasdfmt, exiting installer")
                sys.exit(0)

        argv = ["-y", "-P", "-d", "cdl", "-b", "4096"]

        if intf:
            title = P_("Formatting DASD Device", "Formatting DASD Devices", c)
            msg = P_("Preparing %d DASD device for use with Linux..." % c,
                     "Preparing %d DASD devices for use with Linux..." % c, c)
            pw = intf.progressWindow(title, msg, 1.0)

            for dasd in self._dasdlist:
                log.info("Running dasdfmt on %s" % (dasd,))
                iutil.execWithCallback("/sbin/dasdfmt", argv + [dasd],
                                       stdout="/dev/tty5", stderr="/dev/tty5",
                                       callback=self._updateProgressWindow,
                                       callback_data=pw, echo=False)

            pw.pop()
        else:
            for dasd in self._dasdlist:
                log.info("Running dasdfmt on %s" % (dasd,))
                iutil.execWithRedirect("/sbin/dasdfmt", argv + [dasd],
                                       stdout="/dev/tty5", stderr="/dev/tty5")
示例#45
0
    def dracutSetupString(self, networkStorageDevice):
        netargs = ""

        if networkStorageDevice.nic:
            # Storage bound to a specific nic (ie FCoE)
            nic = networkStorageDevice.nic
        else:
            # Storage bound through ip, find out which interface leads to host
            host = networkStorageDevice.host_address
            route = iutil.execWithCapture("ip", ["route", "get", "to", host])
            if not route:
                log.error("Could net get interface for route to %s" % host)
                return ""

            routeInfo = route.split()
            if routeInfo[0] != host or len(routeInfo) < 5 or \
               "dev" not in routeInfo or routeInfo.index("dev") > 3:
                log.error('Unexpected "ip route get to %s" reply: %s' %
                          (host, routeInfo))
                return ""

            nic = routeInfo[routeInfo.index("dev") + 1]

        if nic not in self.netdevices.keys():
            log.error('Unknown network interface: %s' % nic)
            return ""

        dev = self.netdevices[nic]

        if networkStorageDevice.host_address:
            if dev.get('bootproto').lower() == 'dhcp':
                netargs += "ip=%s:dhcp" % nic
            else:
                if dev.get('GATEWAY'):
                    gateway = dev.get('GATEWAY')
                else:
                    gateway = ""

                if self.hostname:
                    hostname = self.hostname
                else:
                    hostname = ""

                netargs += "ip=%s::%s:%s:%s:%s:none" % (dev.get(
                    'ipaddr'), gateway, dev.get('netmask'), hostname, nic)

        hwaddr = dev.get("HWADDR")
        if hwaddr:
            if netargs != "":
                netargs += " "

            netargs += "ifname=%s:%s" % (nic, hwaddr.lower())

        nettype = dev.get("NETTYPE")
        subchannels = dev.get("SUBCHANNELS")
        if iutil.isS390() and nettype and subchannels:
            if netargs != "":
                netargs += " "

            netargs += "rd_CCW=%s,%s" % (nettype, subchannels)

            options = dev.get("OPTIONS")
            if options:
                options = filter(lambda x: x != '', options.split(' '))
                netargs += ",%s" % (','.join(options))

        return netargs
示例#46
0
文件: dasd.py 项目: 274914765/python
    def startup(self, intf, exclusiveDisks, zeroMbr):
        """ Look for any unformatted DASDs in the system and offer the user
            the option for format them with dasdfmt or exit the installer.
        """
        if self.started:
            return

        self.started = True
        out = "/dev/tty5"
        err = "/dev/tty5"

        if not iutil.isS390():
            return

        # Trigger udev data about the dasd devices on the system
        udev_trigger(action="change", name="dasd*")

        log.info("Checking for unformatted DASD devices:")

        for device in os.listdir("/sys/block"):
            if not device.startswith("dasd"):
                continue

            statusfile = "/sys/block/%s/device/status" % (device,)
            if not os.path.isfile(statusfile):
                continue

            f = open(statusfile, "r")
            status = f.read().strip()
            f.close()

            if status in ["unformatted"] and device not in exclusiveDisks:
                bypath = deviceNameToDiskByPath(device)
                if not bypath:
                    bypath = "/dev/" + device

                log.info("    %s (%s) status is %s, needs dasdfmt" % (device,
                                                                      bypath,
                                                                      status,))
                self._dasdlist.append((device, bypath))

        if not len(self._dasdlist):
            log.info("    no unformatted DASD devices found")
            return

        askUser = True

        if zeroMbr:
            askUser = False
        elif not intf and not zeroMbr:
            log.info("    non-interactive kickstart install without zerombr "
                     "command, unable to run dasdfmt, exiting installer")
            sys.exit(0)

        c = len(self._dasdlist)

        if intf and askUser:
            devs = ''
            for dasd, bypath in self._dasdlist:
                devs += "%s\n" % (bypath,)

            rc = intf.questionInitializeDASD(c, devs)
            if rc == 1:
                log.info("    not running dasdfmt, continuing installation")
                return

        # gather total cylinder count
        argv = ["-t", "-v"] + self.commonArgv
        for dasd, bypath in self._dasdlist:
            buf = iutil.execWithCapture(self.dasdfmt, argv + ["/dev/" + dasd],
                                        stderr=err)
            for line in buf.splitlines():
                if line.startswith("Drive Geometry: "):
                    # line will look like this:
                    # Drive Geometry: 3339 Cylinders * 15 Heads =  50085 Tracks
                    cyls = long(filter(lambda s: s, line.split(' '))[2])
                    self.totalCylinders += cyls
                    break

        # format DASDs
        argv = ["-P"] + self.commonArgv
        update = self._updateProgressWindow

        title = P_("Formatting DASD Device", "Formatting DASD Devices", c)
        msg = P_("Preparing %d DASD device for use with Linux..." % c,
                 "Preparing %d DASD devices for use with Linux..." % c, c)

        if intf:
            if self.totalCylinders:
                pw = intf.progressWindow(title, msg, 1.0)
            else:
                pw = intf.progressWindow(title, msg, 100, pulse=True)

        for dasd, bypath in self._dasdlist:
            log.info("Running dasdfmt on %s" % (bypath,))
            arglist = argv + ["/dev/" + dasd]

            try:
                if intf and self.totalCylinders:
                    rc = iutil.execWithCallback(self.dasdfmt, arglist,
                                                stdout=out, stderr=err,
                                                callback=update,
                                                callback_data=pw,
                                                echo=False)
                elif intf:
                    rc = iutil.execWithPulseProgress(self.dasdfmt, arglist,
                                                     stdout=out, stderr=err,
                                                     progress=pw)
                else:
                    rc = iutil.execWithRedirect(self.dasdfmt, arglist,
                                                stdout=out, stderr=err)
            except Exception as e:
                raise DasdFormatError(e, bypath)

            if rc:
                raise DasdFormatError("dasdfmt failed: %s" % rc, bypath)

        if intf:
            pw.pop()
示例#47
0
    def dracutSetupString(self, networkStorageDevice):
        netargs = ""

        if networkStorageDevice.nic:
            # Storage bound to a specific nic (ie FCoE)
            nic = networkStorageDevice.nic
        else:
            # Storage bound through ip, find out which interface leads to host
            nic = ifaceForHostIP(networkStorageDevice.host_address)
            if not nic:
                return ""

        if nic not in self.netdevices.keys():
            log.error('Unknown network interface: %s' % nic)
            return ""

        dev = self.netdevices[nic]

        if dev.get('BOOTPROTO') == 'ibft':
            netargs += "ip=ibft"
        elif networkStorageDevice.host_address:
            if self.hostname:
                hostname = self.hostname
            else:
                hostname = ""

            # if using ipv6
            if ':' in networkStorageDevice.host_address:
                if dev.get('DHCPV6C') == "yes":
                    # XXX combination with autoconf not yet clear,
                    # support for dhcpv6 is not yet implemented in NM/ifcfg-rh
                    netargs += "ip=%s:dhcp6" % nic
                elif dev.get('IPV6_AUTOCONF') == "yes":
                    netargs += "ip=%s:auto6" % nic
                elif dev.get('IPV6ADDR'):
                    ipaddr = "[%s]" % dev.get('IPV6ADDR')
                    if dev.get('IPV6_DEFAULTGW'):
                        gateway = "[%s]" % dev.get('IPV6_DEFAULTGW')
                    else:
                        gateway = ""
                    netargs += "ip=%s::%s:%s:%s:%s:none" % (
                        ipaddr, gateway, dev.get('PREFIX'), hostname, nic)
            else:
                if dev.get('bootproto').lower() == 'dhcp':
                    netargs += "ip=%s:dhcp" % nic
                else:
                    if dev.get('GATEWAY'):
                        gateway = dev.get('GATEWAY')
                    else:
                        gateway = ""

                    netmask = dev.get('netmask')
                    prefix = dev.get('prefix')
                    if not netmask and prefix:
                        netmask = isys.prefix2netmask(int(prefix))

                    netargs += "ip=%s::%s:%s:%s:%s:none" % (
                        dev.get('ipaddr'), gateway, netmask, hostname, nic)

        hwaddr = dev.get("HWADDR")
        if hwaddr:
            if netargs != "":
                netargs += " "

            netargs += "ifname=%s:%s" % (nic, hwaddr.lower())

        nettype = dev.get("NETTYPE")
        subchannels = dev.get("SUBCHANNELS")
        if iutil.isS390() and nettype and subchannels:
            if netargs != "":
                netargs += " "

            netargs += "rd_ZNET=%s,%s" % (nettype, subchannels)

            options = dev.get("OPTIONS").strip("'\"")
            if options:
                options = filter(lambda x: x != '', options.split(' '))
                netargs += ",%s" % (','.join(options))

        return netargs
示例#48
0
    "parttype" : ("autopart_type", "PartitionTypeWindow"),
    "cleardiskssel": ("cleardisks_gui", "ClearDisksWindow"),
    "findinstall" : ("examine_gui", "UpgradeExamineWindow"),
    "upgrademigratefs" : ("upgrade_migratefs_gui", "UpgradeMigrateFSWindow"),
    "bootloader": ("bootloader_main_gui", "MainBootloaderWindow"),
    "upgbootloader": ("upgrade_bootloader_gui", "UpgradeBootloaderWindow"),
    "network" : ("network_gui", "NetworkWindow"),
    "timezone" : ("timezone_gui", "TimezoneWindow"),
    "accounts" : ("account_gui", "AccountWindow"),
    "tasksel": ("task_gui", "TaskWindow"),
    "group-selection": ("package_gui", "GroupSelectionWindow"),
    "install" : ("progress_gui", "InstallProgressWindow"),
    "complete" : ("congrats_gui", "CongratulationWindow"),
}

if iutil.isS390():
    stepToClass["bootloader"] = ("zipl_gui", "ZiplWindow")

def idle_gtk(func, *args, **kwargs):
    def return_false(func, *args, **kwargs):
        gtk.gdk.threads_enter()
        func(*args, **kwargs)
        gtk.gdk.threads_leave()
        return False
    gobject.idle_add(return_false, func, *args, **kwargs)

#
# Stuff for screenshots
#
screenshotDir = "/tmp/anaconda-screenshots"
screenshotIndex = 0
示例#49
0
    def dracutSetupArgs(self, networkStorageDevice):
        netargs=set()

        if networkStorageDevice.nic == "default" or ":" in networkStorageDevice.nic:
            nic = ifaceForHostIP(networkStorageDevice.host_address)
            if not nic:
                return ""
        else:
            nic = networkStorageDevice.nic

        if nic not in self.netdevices.keys():
            log.error('Unknown network interface: %s' % nic)
            return ""

        dev = self.netdevices[nic]

        if dev.get('BOOTPROTO') == 'ibft':
            netargs.add("ip=ibft")
        elif networkStorageDevice.host_address:
            if self.hostname:
                hostname = self.hostname
            else:
                hostname = ""

            # if using ipv6
            if ':' in networkStorageDevice.host_address:
                if dev.get('DHCPV6C') == "yes":
                    # XXX combination with autoconf not yet clear,
                    # support for dhcpv6 is not yet implemented in NM/ifcfg-rh
                    netargs.add("ip=%s:dhcp6" % nic)
                elif dev.get('IPV6_AUTOCONF') == "yes":
                    netargs.add("ip=%s:auto6" % nic)
                elif dev.get('IPV6ADDR'):
                    ipaddr = "[%s]" % dev.get('IPV6ADDR')
                    if dev.get('IPV6_DEFAULTGW'):
                        gateway = "[%s]" % dev.get('IPV6_DEFAULTGW')
                    else:
                        gateway = ""
                    netargs.add("ip=%s::%s:%s:%s:%s:none" % (ipaddr, gateway,
                               dev.get('PREFIX'), hostname, nic))
            else:
                if dev.get('bootproto').lower() == 'dhcp':
                    netargs.add("ip=%s:dhcp" % nic)
                else:
                    if dev.get('GATEWAY'):
                        gateway = dev.get('GATEWAY')
                    else:
                        gateway = ""

                    netmask = dev.get('netmask')
                    prefix  = dev.get('prefix')
                    if not netmask and prefix:
                        netmask = isys.prefix2netmask(int(prefix))

                    netargs.add("ip=%s::%s:%s:%s:%s:none" % (dev.get('ipaddr'),
                               gateway, netmask, hostname, nic))

        hwaddr = dev.get("HWADDR")
        if hwaddr:
            netargs.add("ifname=%s:%s" % (nic, hwaddr.lower()))

        nettype = dev.get("NETTYPE")
        subchannels = dev.get("SUBCHANNELS")
        if iutil.isS390() and nettype and subchannels:
            znet = "rd_ZNET=%s,%s" % (nettype, subchannels)

            options = dev.get("OPTIONS").strip("'\"")
            if options:
                options = filter(lambda x: x != '', options.split(' '))
                znet += ",%s" % (','.join(options))
            netargs.add(znet)

        return netargs
示例#50
0
    def startup(self, intf, exclusiveDisks, zeroMbr):
        """ Look for any unformatted DASDs in the system and offer the user
            the option for format them with dasdfmt or exit the installer.
        """
        if self.started:
            return

        self.started = True
        out = "/dev/tty5"
        err = "/dev/tty5"

        if not iutil.isS390():
            return

        # Trigger udev data about the dasd devices on the system
        udev_trigger(action="change", name="dasd*")

        log.info("Checking for unformatted DASD devices:")

        for device in os.listdir("/sys/block"):
            if not device.startswith("dasd"):
                continue

            statusfile = "/sys/block/%s/device/status" % (device, )
            if not os.path.isfile(statusfile):
                continue

            f = open(statusfile, "r")
            status = f.read().strip()
            f.close()

            if status in ["unformatted"] and device not in exclusiveDisks:
                bypath = deviceNameToDiskByPath(device)
                if not bypath:
                    bypath = "/dev/" + device

                log.info("    %s (%s) status is %s, needs dasdfmt" % (
                    device,
                    bypath,
                    status,
                ))
                self._dasdlist.append((device, bypath))

        if not len(self._dasdlist):
            log.info("    no unformatted DASD devices found")
            return

        askUser = True

        if zeroMbr:
            askUser = False
        elif not intf and not zeroMbr:
            log.info("    non-interactive kickstart install without zerombr "
                     "command, unable to run dasdfmt, exiting installer")
            sys.exit(0)

        c = len(self._dasdlist)

        if intf and askUser:
            devs = ''
            for dasd, bypath in self._dasdlist:
                devs += "%s\n" % (bypath, )

            rc = intf.questionInitializeDASD(c, devs)
            if rc == 1:
                log.info("    not running dasdfmt, continuing installation")
                return

        # gather total cylinder count
        argv = ["-t", "-v"] + self.commonArgv
        for dasd, bypath in self._dasdlist:
            buf = iutil.execWithCapture(self.dasdfmt,
                                        argv + ["/dev/" + dasd],
                                        stderr=err)
            for line in buf.splitlines():
                if line.startswith("Drive Geometry: "):
                    # line will look like this:
                    # Drive Geometry: 3339 Cylinders * 15 Heads =  50085 Tracks
                    cyls = long(filter(lambda s: s, line.split(' '))[2])
                    self.totalCylinders += cyls
                    break

        # format DASDs
        argv = ["-P"] + self.commonArgv
        update = self._updateProgressWindow

        title = P_("Formatting DASD Device", "Formatting DASD Devices", c)
        msg = P_("Preparing %d DASD device for use with Linux..." % c,
                 "Preparing %d DASD devices for use with Linux..." % c, c)

        if intf:
            if self.totalCylinders:
                pw = intf.progressWindow(title, msg, 1.0)
            else:
                pw = intf.progressWindow(title, msg, 100, pulse=True)

        for dasd, bypath in self._dasdlist:
            log.info("Running dasdfmt on %s" % (bypath, ))
            arglist = argv + ["/dev/" + dasd]

            try:
                if intf and self.totalCylinders:
                    rc = iutil.execWithCallback(self.dasdfmt,
                                                arglist,
                                                stdout=out,
                                                stderr=err,
                                                callback=update,
                                                callback_data=pw,
                                                echo=False)
                elif intf:
                    rc = iutil.execWithPulseProgress(self.dasdfmt,
                                                     arglist,
                                                     stdout=out,
                                                     stderr=err,
                                                     progress=pw)
                else:
                    rc = iutil.execWithRedirect(self.dasdfmt,
                                                arglist,
                                                stdout=out,
                                                stderr=err)
            except Exception as e:
                raise DasdFormatError(e, bypath)

            if rc:
                raise DasdFormatError("dasdfmt failed: %s" % rc, bypath)

        if intf:
            pw.pop()
示例#51
0
def vtActivate (num):
    if iutil.isS390():
        return
    _isys.vtActivate (num)