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 pyanaconda.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(pyanaconda.storage.iscsi.iscsi().ifaces)) dxml.get_widget("iscsiBindCheck").set_sensitive(pyanaconda.storage.iscsi.iscsi().mode == "none") if not pyanaconda.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 pyanaconda.iw.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 put focus on the first one group = dxml.get_widget("iscsiRadio").get_group() for button in reversed(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 pyanaconda.storage.iscsi.has_iscsi(): bind = dxml.get_widget("iscsiBindCheck").get_active() rc = addIscsiDrive(anaconda, bind) elif dxml.get_widget("fcoeRadio").get_active() and pyanaconda.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
def addDriveDialog(self, screen): newdrv = [] if iscsi.has_iscsi(): newdrv.append("Add iSCSI target") if iutil.isS390(): newdrv.append("Add zFCP LUN") if 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
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)
def addDriveDialog(self, screen): newdrv = [] if iscsi.has_iscsi(): newdrv.append("Add iSCSI target") if iutil.isS390(): newdrv.append( "Add zFCP LUN" ) if 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
def addDriveDialog(self, screen): newdrv = [] if iscsi.has_iscsi(): if iscsi.iscsi().mode == "none": newdrv.append("Add iSCSI target") newdrv.append("Add iSCSI target - use interface binding") elif iscsi.iscsi().mode == "bind": newdrv.append("Add iSCSI target - use interface binding") elif iscsi.iscsi().mode == "default": newdrv.append("Add iSCSI target") if iutil.isS390(): newdrv.append( "Add zFCP LUN" ) if 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 as e: ButtonChoiceWindow(screen, _("Error"), str(e)) return INSTALL_BACK elif newdrv[choice] == "Add FCoE SAN": try: return self.addFcoeDriveDialog(screen) except ValueError as e: ButtonChoiceWindow(screen, _("Error"), str(e)) return INSTALL_BACK elif newdrv[choice].startswith("Add iSCSI target"): bind = newdrv[choice] == "Add iSCSI target - use interface binding" try: return self.addIscsiDriveDialog(screen, bind) except (ValueError, IOError) as e: ButtonChoiceWindow(screen, _("Error"), str(e)) return INSTALL_BACK
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 pyanaconda.storage.iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) if not pyanaconda.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 put focus on the first one group = dxml.get_widget("iscsiRadio").get_group() for button in reversed(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 pyanaconda.storage.iscsi.has_iscsi(): rc = addIscsiDrive(anaconda) elif dxml.get_widget( "fcoeRadio").get_active() and pyanaconda.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
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 pyanaconda.storage.iscsi.has_iscsi(): dxml.get_widget("iscsiRadio").set_sensitive(False) dxml.get_widget("iscsiRadio").set_active(False) if not pyanaconda.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 put focus on the first one group = dxml.get_widget("iscsiRadio").get_group() for button in reversed(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 pyanaconda.storage.iscsi.has_iscsi(): rc = addIscsiDrive(anaconda) elif dxml.get_widget("fcoeRadio").get_active() and pyanaconda.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
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 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: ret = iutil.execWithCallback(self.dasdfmt, arglist, stdout=out, stderr=err, callback=update, callback_data=pw, echo=False) rc = ret.rc elif intf: ret = iutil.execWithPulseProgress(self.dasdfmt, arglist, stdout=out, stderr=err, progress=pw) rc = ret.rc 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()
def vtActivate(num): if iutil.isS390(): return _isys.vtActivate(num)
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) column.set_fixed_width(25) self.clickCB = clickCB def createAlignedLabel(text): label = gtk.Label(text) label.set_alignment(0.0, 0.5) label.set_property("use-underline", True) return label defaultMountPoints = ['/', '/boot', '/home', '/tmp', '/var', '/usr/local', '/opt'] if iutil.isS390(): # Many s390 have 2G DASDs, we recomment putting /usr/share on its own DASD defaultMountPoints.insert(5, '/usr/share') if iutil.isEfi(): defaultMountPoints.insert(2, '/boot/efi') def createMountPointCombo(request, excludeMountPoints=[]): mountCombo = gtk.combo_box_entry_new_text() mntptlist = [] label = getattr(request.format, "label", None) if request.exists and label and label.startswith("/"): mntptlist.append(label) idx = 0
self.clickCB = clickCB def createAlignedLabel(text): label = gtk.Label(text) label.set_alignment(0.0, 0.5) label.set_property("use-underline", True) return label defaultMountPoints = [ '/', '/boot', '/home', '/tmp', '/var', '/usr/local', '/opt' ] if iutil.isS390(): # Many s390 have 2G DASDs, we recomment putting /usr/share on its own DASD defaultMountPoints.insert(5, '/usr/share') if iutil.isEfi(): defaultMountPoints.insert(2, '/boot/efi') def createMountPointCombo(request, excludeMountPoints=[]): mountCombo = gtk.combo_box_entry_new_text() mntptlist = [] label = getattr(request.format, "label", None) if request.exists and label and label.startswith("/"): mntptlist.append(label) idx = 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 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: ret = iutil.execWithCallback(self.dasdfmt, arglist, stdout=out, stderr=err, callback=update, callback_data=pw, echo=False) rc = ret.rc elif intf: ret = iutil.execWithPulseProgress(self.dasdfmt, arglist, stdout=out, stderr=err, progress=pw) rc = ret.rc 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()