Ack, with comments. On Tue, Feb 28, 2012 at 12:03:29PM +0100, Radek Vykydal wrote: > Resolves: rhbz#500273 > > Also write out proper dracut options: > > netroot=iscsi:[<servername>]:[<protocol>]:[<port>]: > [<iscsi_iface_name>]:[<netdev_name>]:[<LUN>]:<targetname> > --- > network.py | 22 ++++++++-------------- > storage/devices.py | 16 +++++++++++++--- > storage/devicetree.py | 9 ++++++--- > storage/iscsi.py | 4 ++-- > storage/udev.py | 6 ++++++ > 5 files changed, 35 insertions(+), 22 deletions(-) > > diff --git a/network.py b/network.py > index 98dd4af..ec35068 100644 > --- a/network.py > +++ b/network.py > @@ -279,7 +279,7 @@ class NetworkDevice(IfcfgFile): > def usedByFCoE(self, anaconda): > import storage > for d in anaconda.id.storage.devices: > - if (isinstance(d, storage.devices.NetworkStorageDevice) and > + if (isinstance(d, storage.devices.FcoeDiskDevice) and > d.nic == self.iface): > return True > return False > @@ -288,20 +288,14 @@ class NetworkDevice(IfcfgFile): > import storage > rootdev = anaconda.id.storage.rootDevice > for d in anaconda.id.storage.devices: > - if (isinstance(d, storage.devices.NetworkStorageDevice) and > - d.host_address and > + if (isinstance(d, storage.devices.iScsiDiskDevice) and > rootdev.dependsOn(d)): > - if self.iface == ifaceForHostIP(d.host_address): > - return True > - return False > - > - def usedByISCSI(self, anaconda): > - import storage > - for d in anaconda.id.storage.devices: > - if (isinstance(d, storage.devices.NetworkStorageDevice) and > - d.host_address): > - if self.iface == ifaceForHostIP(d.host_address): > - return True > + if d.nic: > + if self.iface == d.nic: > + return True This could be reduced to: if d.nic and self.iface == d.nic: return True > + else: > + if self.iface == ifaceForHostIP(d.host_address): > + return True These could just be merged to an elif line. > return False > > class Network: > diff --git a/storage/devices.py b/storage/devices.py > index 3810b24..d847cb9 100644 > --- a/storage/devices.py > +++ b/storage/devices.py > @@ -3609,10 +3609,16 @@ class iScsiDiskDevice(DiskDevice, NetworkStorageDevice): > def __init__(self, device, **kwargs): > self.node = kwargs.pop("node") > self.ibft = kwargs.pop("ibft") > + self.nic = kwargs.pop("nic") > self.initiator = kwargs.pop("initiator") > DiskDevice.__init__(self, device, **kwargs) > - NetworkStorageDevice.__init__(self, host_address=self.node.address) > - log.debug("created new iscsi disk %s %s:%d" % (self.node.name, self.node.address, self.node.port)) > + NetworkStorageDevice.__init__(self, host_address=self.node.address, > + nic=self.nic) > + log.debug("created new iscsi disk %s %s:%d via %s:%s" % (self.node.name, > + self.node.address, > + self.node.port, > + self.node.iface, > + self.nic)) > > def dracutSetupArgs(self): > if self.ibft: > @@ -3631,7 +3637,11 @@ class iScsiDiskDevice(DiskDevice, NetworkStorageDevice): > netroot += ":%s:%s" % (auth.reverse_username, > auth.reverse_password) > > - netroot += "@%s::%d::%s" % (address, self.node.port, self.node.name) > + netroot += "@%s::%d:%s:%s::%s" % (address, > + self.node.port, > + self.node.iface, > + self.nic, > + self.node.name) > > initiator = "iscsi_initiator=%s" % self.initiator > > diff --git a/storage/devicetree.py b/storage/devicetree.py > index ffd6732..e6ae639 100644 > --- a/storage/devicetree.py > +++ b/storage/devicetree.py > @@ -1180,11 +1180,14 @@ class DeviceTree(object): > kwargs = { "serial": serial, "vendor": vendor, "bus": bus } > if udev_device_is_iscsi(info): > diskType = iScsiDiskDevice > - kwargs["node"] = self.iscsi.getNode( > + node = self.iscsi.getNode( > udev_device_get_iscsi_name(info), > udev_device_get_iscsi_address(info), > - udev_device_get_iscsi_port(info)) > - kwargs["ibft"] = kwargs["node"] in self.iscsi.ibftNodes > + udev_device_get_iscsi_port(info), > + udev_device_get_iscsi_nic(info)) > + kwargs["node"] = node > + kwargs["nic"] = self.iscsi.ifaces.get(node.iface, node.iface) > + kwargs["ibft"] = node in self.iscsi.ibftNodes > kwargs["initiator"] = self.iscsi.initiator > log.debug("%s is an iscsi disk" % name) > elif udev_device_is_fcoe(info): > diff --git a/storage/iscsi.py b/storage/iscsi.py > index f4dfee4..34c4ad0 100644 > --- a/storage/iscsi.py > +++ b/storage/iscsi.py > @@ -446,10 +446,10 @@ class iscsi(object): > shutil.copytree("/var/lib/iscsi", instPath + "/var/lib/iscsi", > symlinks=True) > > - def getNode(self, name, address, port): > + def getNode(self, name, address, port, iface): > for node in self.active_nodes(): > if node.name == name and node.address == address and \ > - node.port == int(port): > + node.port == int(port) and node.iface == iface: > return node > > return None > diff --git a/storage/udev.py b/storage/udev.py > index d9a5d13..7890c17 100644 > --- a/storage/udev.py > +++ b/storage/udev.py > @@ -553,6 +553,12 @@ def udev_device_get_iscsi_port(info): > # IPV6 contains : within the address, the part after the last : is the port > return path_components[address_field].split(":")[-1] > > +def udev_device_get_iscsi_nic(info): > + session = info["sysfs_path"].split("/")[4] > + iface = open("/sys/class/iscsi_session/%s/ifacename" % > + session).read().strip() > + return iface > + > # fcoe disks have ID_PATH in the form of: > # For FCoE directly over the NIC (so no VLAN and thus no DCB): > # pci-eth#-fc-${id} > -- > 1.7.4 > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list -- David Cantrell <dcantrell@xxxxxxxxxx> Supervisor, Installer Engineering Team Red Hat, Inc. | Westford, MA | EST5EDT _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list