Re: [rhel6-branch 3/3] fcoe: handle Broadcom fcoe devices correctly.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't see anything wrong, push it all.

--
Martin Sivák
msivak@xxxxxxxxxx
Red Hat Czech
Anaconda team / Brno, CZ

----- Original Message -----
> This includes some udev.py trickery.
> 
> Original patch proposed by Eugene Cho <echo@xxxxxxxxxxxx>
> 
> Resolves: rhbz#641420
> ---
> storage/devices.py | 3 ++-
> storage/fcoe.py | 13 ++++++++++---
> storage/udev.py | 30 ++++++++++++++++++++++++++++++
> 3 files changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/storage/devices.py b/storage/devices.py
> index 5a64e70..e7d0fa0 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -3623,7 +3623,8 @@ class FcoeDiskDevice(DiskDevice,
> NetworkStorageDevice):
> self.identifier = kwargs.pop("identifier")
> DiskDevice.__init__(self, device, **kwargs)
> NetworkStorageDevice.__init__(self, nic=self.nic)
> - log.debug("created new fcoe disk %s @ %s" % (device, self.nic))
> + log.debug("created new fcoe disk %s (%s) @ %s" %
> + (device, self.identifier, self.nic))
> 
> def dracutSetupArgs(self):
> dcb = True
> diff --git a/storage/fcoe.py b/storage/fcoe.py
> index d3f0c1a..c8b957d 100644
> --- a/storage/fcoe.py
> +++ b/storage/fcoe.py
> @@ -129,9 +129,16 @@ class fcoe(object):
> iutil.execWithRedirect("fipvlan", [ nic, "-c", "-s" ],
> stdout = "/dev/tty5", stderr="/dev/tty5")
> else:
> - f = open("/sys/module/libfcoe/parameters/create", "w")
> - f.write(nic)
> - f.close()
> + # Use fipvlan instead of fcoe's create if nic uses bnx2x driver.
> + # Ideally, this should be done by checking a "AUTO_VLAN" parameter,
> + # not bnx2x driver usage
> + if 'bnx2x' in os.path.realpath('/sys/class/net/%s/device/driver'
> %(nic)):
> + iutil.execWithRedirect("fipvlan", ['-c', '-s', nic],
> + stdout = "/dev/tty5", stderr="/dev/tty5")
> + else:
> + f = open("/sys/module/libfcoe/parameters/create", "w")
> + f.write(nic)
> + f.close()
> 
> self._stabilize(intf)
> self.nics.append((nic, dcb))
> diff --git a/storage/udev.py b/storage/udev.py
> index 8b0006f..d9a5d13 100644
> --- a/storage/udev.py
> +++ b/storage/udev.py
> @@ -569,6 +569,22 @@ def udev_device_get_iscsi_port(info):
> # And for a partition:
> #
> /devices/virtual/net/eth4.802-fcoe/host3/rport-3:0-4/target3:0:1/3:0:1:0/block/sde/sde1
> 
> +# This is completely different for Broadcom FCoE devices (bnx2fc),
> where we use
> +# the sysfs path:
> +#
> /devices/pci0000:00/0000:00:02.0/0000:09:00.0/0000:0a:01.0/0000:0e:00.0/host3/rport-3:0-2/target3:0:1/3:0:1:3/block/sdm
> +# and find whether the host has 'fc_host' and if it the device has a
> bound
> +# Ethernet interface.
> +
> +def _detect_broadcom_fcoe(info):
> + re_pci_host=re.compile('/(.*)/(host\d+)')
> + match = re_pci_host.match(info["sysfs_path"])
> + if match:
> + sysfs_pci, host = match.groups()
> + if os.access('/sys/%s/%s/fc_host' %(sysfs_pci, host), os.X_OK) and \
> + os.access('/sys/%s/net' %(sysfs_pci), os.X_OK):
> + return (sysfs_pci, host)
> + return (None, None)
> +
> def udev_device_is_fcoe(info):
> if info.get("ID_BUS") != "scsi":
> return False
> @@ -583,6 +599,9 @@ def udev_device_is_fcoe(info):
> if path.startswith("fc-") and "fcoe" in info["sysfs_path"]:
> return True
> 
> + if _detect_broadcom_fcoe(info) != (None, None):
> + return True
> +
> return False
> 
> def udev_device_get_fcoe_nic(info):
> @@ -596,6 +615,13 @@ def udev_device_get_fcoe_nic(info):
> if path.startswith("fc-") and "fcoe" in info["sysfs_path"]:
> return info["sysfs_path"].split("/")[4].split(".")[0]
> 
> + (sysfs_pci, host) = _detect_broadcom_fcoe(info)
> + if (sysfs_pci, host) != (None, None):
> + net_path = '/sys/%s/net' % sysfs_pci
> + listdir = os.listdir(net_path)
> + if len(listdir) > 0 :
> + return listdir[0]
> +
> def udev_device_get_fcoe_identifier(info):
> path = info.get("ID_PATH", "")
> path_components = path.split("-")
> @@ -606,3 +632,7 @@ def udev_device_get_fcoe_identifier(info):
> 
> if path.startswith("fc-") and "fcoe" in info["sysfs_path"]:
> return path_components[1]
> +
> + if udev_device_is_fcoe(info) and len(path_components) >= 4 and \
> + path_components[2] == 'fc':
> + return path_components[3]
> --
> 1.7.6
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux