Re: [PATCH 1/3] Add FCoE support to storage/udev.py

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

 



On Thu, 2009-07-02 at 12:28 +0200, Hans de Goede wrote:
> Add the ability to identify if a disk is an FCoE device and to
> get the identifier of the disk and the name of the NIC used to
> connect to an FCoE disk

One comment, below.

> ---
>  storage/udev.py |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/storage/udev.py b/storage/udev.py
> index af3ee12..d057cf2 100644
> --- a/storage/udev.py
> +++ b/storage/udev.py
> @@ -386,3 +386,30 @@ def udev_device_get_iscsi_port(info):
>      path_components = info["ID_PATH"].split("-")
>  
>      return path_components[1].split(":")[1]
> +
> +# fcoe disks have ID_PATH in the form of:
> +# pci-eth#-fc-${id}
> +# fcoe parts look like this:
> +# pci-eth#-fc-${id}-part#
> +def udev_device_is_fcoe(info):
> +    try:
> +        path_components = info["ID_PATH"].split("-")
> +
> +        if info["ID_BUS"] == "scsi" and len(path_components) >= 4 and \
> +           path_components[0] == "pci" and path_components[2] == "fc" and \
> +           path_components[1][0:3] == "eth":
> +            return True
> +    except KeyError:
> +        pass

If you use LookupError instead, it will also catch index errors in the
event that the ID_PATH value is somehow invalid.

Dave

> +
> +    return False
> +
> +def udev_device_get_fcoe_nic(info):
> +    path_components = info["ID_PATH"].split("-")
> +
> +    return path_components[1]
> +
> +def udev_device_get_fcoe_identifier(info):
> +    path_components = info["ID_PATH"].split("-")
> +
> +    return path_components[3]

_______________________________________________
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