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}
On Thu, May 31, 2012 at 11:12:52AM +0200, Radek Vykydal wrote:
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
The comments mention qla4xxx but nothing checks for that, it depends on the node being None. Is there other hardware that could also trigger this condition that would need to be handled differently?
On 05/31/2012 06:49 PM, Brian C. Lane wrote:
On Thu, May 31, 2012 at 11:12:52AM +0200, Radek Vykydal wrote:
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
The comments mention qla4xxx but nothing checks for that, it depends on the node being None. Is there other hardware that could also trigger this condition that would need to be handled differently?
There is no such other hardware. Having iscsi device in tree without Node discovered and managed by anaconda/iscsiadm is something new that qla4xxx in firmware boot mode requires.
I was thinking about adding some attribute or property to iSCSIDiskDevice so that the conditions in some places (generating dracut arguments, modifying ifcfg files) are more clear but I'd like to do it also for some other cases and I want to keep this post-RC 6.3 patch as safe as possible.
Perhaps the comment can be improved, what about
# qla4xxx in firmware boot mode (#823810)
Radek
Ack, for the record.
anaconda-devel@lists.stg.fedoraproject.org