These kind of devices, when qla4xxx.ql4xdisablesysfsboot=1, is discovered by anaconda/udev as iscsi device yet it can not be handled by iscsiadm so we need to treat it specially. Resolves: rhbz#823810 --- storage/devices.py | 33 +++++++++++++++++++++++++-------- storage/devicetree.py | 30 ++++++++++++++++++++---------- storage/udev.py | 28 +++++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 21 deletions(-) diff --git a/storage/devices.py b/storage/devices.py index 96c6238..674ef5a 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -3634,19 +3634,36 @@ class iScsiDiskDevice(DiskDevice, NetworkStorageDevice): 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, - 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)) + + if self.node is None: + # qla4xxx partial offload + name = kwargs.pop("fw_name") + address = kwargs.pop("fw_address") + port = kwargs.pop("fw_port") + DiskDevice.__init__(self, device, **kwargs) + NetworkStorageDevice.__init__(self, + host_address=address, + nic=self.nic) + log.debug("created new iscsi disk %s %s:%s using fw initiator %s" + % (name, address, port, self.initiator)) + else: + DiskDevice.__init__(self, device, **kwargs) + 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: return set(["iscsi_firmware"]) + # qla4xxx partial offload + if self.node is None: + return set() + address = self.node.address # surround ipv6 addresses with [] if ":" in address: diff --git a/storage/devicetree.py b/storage/devicetree.py index e6ae639..30d0a2a 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -1180,16 +1180,26 @@ class DeviceTree(object): kwargs = { "serial": serial, "vendor": vendor, "bus": bus } if udev_device_is_iscsi(info): diskType = iScsiDiskDevice - node = self.iscsi.getNode( - udev_device_get_iscsi_name(info), - udev_device_get_iscsi_address(info), - 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) + initiator = udev_device_get_iscsi_initiator(info) + target = udev_device_get_iscsi_name(info) + address = udev_device_get_iscsi_address(info) + port = udev_device_get_iscsi_port(info) + nic = udev_device_get_iscsi_nic(info) + kwargs["initiator"] = initiator + if initiator == self.iscsi.initiator: + node = self.iscsi.getNode(target, address, port, nic) + kwargs["node"] = node + kwargs["ibft"] = node in self.iscsi.ibftNodes + kwargs["nic"] = self.iscsi.ifaces.get(node.iface, node.iface) + log.debug("%s is an iscsi disk" % name) + else: + # qla4xxx partial offload + kwargs["node"] = None + kwargs["ibft"] = False + kwargs["nic"] = "offload:not_accessible_via_iscsiadm" + kwargs["fw_address"] = address + kwargs["fw_port"] = port + kwargs["fw_name"] = name elif udev_device_is_fcoe(info): diskType = FcoeDiskDevice kwargs["nic"] = udev_device_get_fcoe_nic(info) diff --git a/storage/udev.py b/storage/udev.py index f00e316..15ec238 100644 --- a/storage/udev.py +++ b/storage/udev.py @@ -553,19 +553,41 @@ 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): +def udev_device_get_iscsi_session(info): # '/devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:01.0/0000:0e:00.2/host3/session1/target3:0:0/3:0:0:0/block/sda' # The position of sessionX part depends on device # (e.g. offload vs. sw; also varies for different offload devs) + session = None match = re.match('/.*/(session\d+)', info["sysfs_path"]) if match: session = match.groups()[0] + else: + log.error("udev_device_get_iscsi_session: session not found in %s" % info) + return session + + +def udev_device_get_iscsi_nic(info): + iface = None + session = udev_device_get_iscsi_session(info) + if session: iface = open("/sys/class/iscsi_session/%s/ifacename" % session).read().strip() - else: - iface = None return iface +def udev_device_get_iscsi_initiator(info): + initiator = None + if udev_device_is_partoff_iscsi(info): + host = re.match('.*/(host\d+)', info["sysfs_path"]).groups()[0] + initiator = open("/sys/class/iscsi_host/%s/initiatorname" % + host).read().strip() + else: + session = udev_device_get_iscsi_session(info) + if session: + initiator = open("/sys/class/iscsi_session/%s/initiatorname" % + session).read().strip() + return initiator + + # 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