Resolves: rhbz#500273 Also write out proper dracut options: netroot=iscsi:[<servername>]:[<protocol>]:[<port>]: [<iscsi_iface_name>]:[<netdev_name>]:[<LUN>]:<targetname> --- pyanaconda/network.py | 24 ++++++++++-------------- pyanaconda/storage/devices.py | 16 +++++++++++++--- pyanaconda/storage/devicetree.py | 9 ++++++--- pyanaconda/storage/iscsi.py | 4 ++-- pyanaconda/storage/udev.py | 6 ++++++ 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/pyanaconda/network.py b/pyanaconda/network.py index 40026a9..cf7085a 100644 --- a/pyanaconda/network.py +++ b/pyanaconda/network.py @@ -343,7 +343,7 @@ class NetworkDevice(IfcfgFile): def usedByFCoE(self, anaconda): import storage for d in anaconda.storage.devices: - if (isinstance(d, storage.devices.NetworkStorageDevice) and + if (isinstance(d, storage.devices.FcoeDiskDevice) and d.nic == self.iface): return True return False @@ -352,20 +352,16 @@ class NetworkDevice(IfcfgFile): import storage rootdev = anaconda.storage.rootDevice for d in anaconda.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.storage.devices: - if (isinstance(d, storage.devices.NetworkStorageDevice) and - d.host_address): - if self.iface == ifaceForHostIP(d.host_address): - return True + # device is bound to nic + if d.nic: + if self.iface == d.nic: + return True + # device is using default interface + else: + if self.iface == ifaceForHostIP(d.host_address): + return True return False class WirelessNetworkDevice(NetworkDevice): diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py index 3b18390..636f5ad 100644 --- a/pyanaconda/storage/devices.py +++ b/pyanaconda/storage/devices.py @@ -3641,10 +3641,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: @@ -3663,7 +3669,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/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py index 6ca2255..561ac5f 100644 --- a/pyanaconda/storage/devicetree.py +++ b/pyanaconda/storage/devicetree.py @@ -842,11 +842,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.info("%s is an iscsi disk" % name) elif udev_device_is_fcoe(info): diff --git a/pyanaconda/storage/iscsi.py b/pyanaconda/storage/iscsi.py index dab323c..b1ee5a4 100644 --- a/pyanaconda/storage/iscsi.py +++ b/pyanaconda/storage/iscsi.py @@ -447,10 +447,10 @@ class iscsi(object): shutil.copytree("/var/lib/iscsi", ROOT_PATH + "/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/pyanaconda/storage/udev.py b/pyanaconda/storage/udev.py index dcdf6bc..20833f3 100644 --- a/pyanaconda/storage/udev.py +++ b/pyanaconda/storage/udev.py @@ -556,6 +556,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