This is the main part of the patch. Add and use iscsi gui install method. diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/dispatch.py iscsi-anaconda-10.90.25/dispatch.py --- anaconda-10.90.25/dispatch.py 2005-12-10 09:54:19.000000000 -0800 +++ iscsi-anaconda-10.90.25/dispatch.py 2006-01-11 20:35:11.000000000 -0800 @@ -65,6 +65,7 @@ installSteps = [ ("findrootparts", findRootParts, ("intf", "id", "dispatch", "dir", "instPath")), ("findinstall", ("dispatch", "intf", "id", "instPath")), ("installtype", ("dispatch", "id", "method", "intf")), + ("iscsi", ("id.iscsi", "intf")), ("zfcpconfig", ("id.zfcp", "id.diskset", "intf")), ("partitionobjinit", partitionObjectsInitialize, ("id.diskset", "id.partitions", diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/gui.py iscsi-anaconda-10.90.25/gui.py --- anaconda-10.90.25/gui.py 2006-01-04 10:53:18.000000000 -0800 +++ iscsi-anaconda-10.90.25/gui.py 2006-01-11 20:35:11.000000000 -0800 @@ -60,6 +60,7 @@ stepToClass = { "mouse" : ("mouse_gui", "MouseWindow"), "welcome" : ("welcome_gui", "WelcomeWindow"), "installtype" : ("installpath_gui", "InstallPathWindow"), + "iscsi" : ("iscsi_gui", "iscsiWindow"), "zfcpconfig" : ("zfcp_gui", "ZFCPWindow"), "partitionmethod" : ("partmethod_gui", "PartitionMethodWindow"), "partition" : ("partition_gui", "PartitionWindow"), diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/instdata.py iscsi-anaconda-10.90.25/instdata.py --- anaconda-10.90.25/instdata.py 2005-11-07 12:56:58.000000000 -0800 +++ iscsi-anaconda-10.90.25/instdata.py 2006-01-11 20:35:11.000000000 -0800 @@ -27,6 +27,7 @@ import bootloader import partitions import partedUtils import hdrlist +import iscsi import zfcp import urllib import iutil @@ -52,6 +53,8 @@ class InstallData: self.instClass = None self.network = network.Network() + if flags.iscsi: + self.iscsi = iscsi.iscsi() self.zfcp = zfcp.ZFCP() self.firewall = firewall.Firewall() self.security = security.Security() diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/iscsi.py iscsi-anaconda-10.90.25/iscsi.py --- anaconda-10.90.25/iscsi.py 1969-12-31 16:00:00.000000000 -0800 +++ iscsi-anaconda-10.90.25/iscsi.py 2006-01-13 08:03:29.000000000 -0800 @@ -0,0 +1,122 @@ +# +# iscsi.py - iscsi class +# +# Copyright 2005 IBM +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +import os +import re +import string +import signal +import iutil +import logging +log = logging.getLogger("anaconda") + +ISCSID_NAME="iscsid" + +# Note that stage2 copies all files under /sbin to /usr/sbin +ISCSID_BIN = "/usr/sbin/iscsid" +ISCSIADM = "/usr/sbin/iscsiadm" +ISCSID_DB_DIR="/var/db/iscsi" +INITIATOR_FILE="/etc/initiatorname.iscsi" + +class iscsi: + + def __init__(self): + self.ipaddr = "" + self.initiator = None + self.port = None + # The following should just be a global but there were errors with + # it not getting correctly initialized + self.iscsidStarted = False + return + + def login_out(self, action): + # + # login or logout from all iSCSI targets. + # + # For each record (line of output) in: + # iscsiadm -m node + # + # Where each line in the output of the form: + # [recnum] stuff + # + # Strip out off the braces and trailing text, strip the trailing + # newline, and issue the "action" request to recnum. + # + command = ("%s -m node" % (ISCSIADM, )) + log.info("Running %s" % (command, )) + records = os.popen(command, 'r').readlines() + + regex = re.compile('\[ ( [^\]]* ) ].*', re.VERBOSE) + for i in records: + recnum = regex.sub(r'\1', i) + recnum = re.sub('\n', '', recnum) + command = ("%s -m node -r %s %s" % (ISCSIADM, recnum, action)) + log.info("Running %s" % (command, )) + os.system(command) + + def shutdown(self): + log.info("iSCSI shutdown") + + self.login_out("--logout") + + # Note that iscsid has/had code to ignore 2 (SIGINT), hence the + # 9 (SIGKILL). + command = ("ps -C %s" % (ISCSID_NAME)) + log.info("Running popen %s" % (command, )) + psout = os.popen(command) + # Skip header line + psout.readline() + for line in psout.readlines(): + pid = string.atoi(string.split(line)[0]) + log.info("Killing %s %d" % (ISCSID_NAME, pid)) + os.kill(pid, signal.SIGKILL) + + return + + def startup(self): + + if self.iscsidStarted: + self.shutdown() + self.iscsidStarted = False; + + if not self.ipaddr: + log.info("iSCSI startup: No iscsi IP address specified") + return + + log.info("Setting up %s" % (INITIATOR_FILE, )) + if os.path.exists(INITIATOR_FILE): + os.unlink(INITIATOR_FILE) + fd = os.open(INITIATOR_FILE, os.O_RDWR | os.O_CREAT) + os.write(fd, "InitiatorName=") + os.write(fd, self.initiator) + os.write(fd, "\n") + os.close(fd) + + if not os.path.exists(ISCSID_DB_DIR): + iutil.mkdirChain(ISCSID_DB_DIR) + + log.info("Starting %s" % (ISCSID_BIN, )) + os.system(ISCSID_BIN) + self.iscsidStarted = True; + + command = ("%s -m discovery -t st -p %s:%s" + % (ISCSIADM, self.ipaddr, self.port)) + log.info("Running %s" % (command, )) + os.system(command) + + self.login_out("--login") + + return + + def writeKS(self,fcpdevices): + # XXX + return diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/iw/iscsi_gui.py iscsi-anaconda-10.90.25/iw/iscsi_gui.py --- anaconda-10.90.25/iw/iscsi_gui.py 1969-12-31 16:00:00.000000000 -0800 +++ iscsi-anaconda-10.90.25/iw/iscsi_gui.py 2006-01-11 20:35:11.000000000 -0800 @@ -0,0 +1,87 @@ +# +# iscsi_gui.py: gui interface for configuration of iscsi +# +# Copyright 2005 IBM, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# general public license. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + + +import gtk +import gobject +import gui +import iutil +from rhpl.translate import _, N_ +from iw_gui import * +import ipwidget + +import logging +log = logging.getLogger("anaconda") + +class iscsiWindow(InstallWindow): + def __init__(self, ics): + InstallWindow.__init__(self, ics) + ics.setTitle(_("iSCSI Configuration")) + ics.setNextEnabled(True) + # ics.readHTML("iSCSI") + + def getPrev(self): + log.info("iscsi prev") + if self.iscsi.ipaddr: + log.info("iscsi shutting down") + self.iscsi.shutdown() + else: + log.info("iscsi no ipaddr ...") + return + + def getNext(self): + + try: + self.iscsi.ipaddr = self.ip_widget.dehydrate() + except ipwidget.IPMissing, msg: + self.intf.messageWindow(_("Error with Data"), + _("No IP address entered, skipping iSCSI setup")) + except ipwidget.IPError, msg: + self.intf.messageWindow(_("Error with Data"), _("%s") % (msg[0],)) + raise gui.StayOnScreen + + self.iscsi.port = self.port.get_text() + self.iscsi.initiator = self.initiator.get_text() + + log.info("iscsi ip address %s, port %s" % (self.iscsi.ipaddr, self.iscsi.port)) + log.info("iscsi initiator %s", self.iscsi.initiator) + + if self.iscsi.ipaddr: + self.iscsi.startup() + + return None + + def getScreen(self, iscsi, intf): + self.intf = intf + self.iscsi = iscsi + + (self.xml, widget) = gui.getGladeWidget("iscsi-config.glade", "iscsiRows") + self.port = self.xml.get_widget("iscsiPort") + self.initiator = self.xml.get_widget("iscsiInitiator") + if self.iscsi.initiator: + self.initiator.set_text(self.iscsi.initiator) + if self.iscsi.port: + self.port.set_text(self.iscsi.port) + + self.ip_table = self.xml.get_widget("iscsiTable") + self.ip_widget = ipwidget.IPEditor() + self.ip_widget.hydrate(self.iscsi.ipaddr) + + # put the IP address widget in the right (1, 2) upper (0, 1) + # corner of our 3 rows by 2 columns table. + + # XXX there is too much space around the IP address. Using this + # variant had no affect: + # self.ip_table.attach(self.ip_widget.getWidget(), 1, 2, 0, 1, gtk.FILL|gtk.EXPAND) + self.ip_table.attach(self.ip_widget.getWidget(), 1, 2, 0, 1) + return widget diff -uprN -X /home/patman/dontdiff anaconda-10.90.25/ui/iscsi-config.glade iscsi-anaconda-10.90.25/ui/iscsi-config.glade --- anaconda-10.90.25/ui/iscsi-config.glade 1969-12-31 16:00:00.000000000 -0800 +++ iscsi-anaconda-10.90.25/ui/iscsi-config.glade 2006-01-11 20:35:11.000000000 -0800 @@ -0,0 +1,215 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="iSCSI"> + <property name="visible">True</property> + <property name="title">iSCSI parameters</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="default_width">200</property> + <property name="default_height">150</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + + <child> + <widget class="GtkVBox" id="iscsiRows"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Enter iSCSI configuration information</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">1</property> + <property name="top_padding">10</property> + <property name="bottom_padding">0</property> + <property name="left_padding">30</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkTable" id="iscsiTable"> + <property name="border_width">10</property> + <property name="visible">True</property> + <property name="n_rows">3</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">4</property> + <property name="column_spacing">4</property> + + <child> + <widget class="GtkLabel" id="labeliscsiAddr"> + <property name="visible">True</property> + <property name="label" translatable="yes">Target IP Address</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="labeliscsiPort"> + <property name="visible">True</property> + <property name="label" translatable="yes">port number [default 3260]</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="labeliscsiInititiator"> + <property name="visible">True</property> + <property name="label" translatable="yes">Initiator</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="iscsiPort"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes">3260</property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + <property name="width_chars">6</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkEntry" id="iscsiInitiator"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface>