Re: [PATCH 3/4] Show ccw names for DASD and zFCP, WWID for mpath (#580507)

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

 



I have a replacement patch, stay tuned.

On 06/02/2010 09:59 PM, David Cantrell wrote:
> In the partition editor UI, we get device names for DASD as "dasda",
> "dasdb", and so on.  For zFCP, we get "sda", "sdb", and so on.  The ccw
> identifiers are more useful to s390 users, so display those on this
> screen if we have them, otherwise fall back on the current name.
> 
> For mpath devices, try to display the WWID if we have it, otherwise show
> the current name.
> ---
>  iw/partition_gui.py |   17 +++++++++++++++++
>  storage/devices.py  |   16 ++++++++++++++++
>  2 files changed, 33 insertions(+), 0 deletions(-)
> 
> diff --git a/iw/partition_gui.py b/iw/partition_gui.py
> index 7420df6..7408126 100644
> --- a/iw/partition_gui.py
> +++ b/iw/partition_gui.py
> @@ -20,6 +20,7 @@
>  #            Michael Fulbright <msf@xxxxxxxxxx>
>  #
> 
> +import os
>  import gobject
>  import gtk
>  import gtk.glade
> @@ -34,6 +35,7 @@ import string
>  import types
>  import copy
> 
> +import iutil
>  import storage
>  from iw_gui import *
>  from flags import flags
> @@ -50,6 +52,8 @@ from storage.partitioning import doPartitioning
>  from storage.partitioning import hasFreeDiskSpace
>  from storage.devicelibs import lvm
>  from storage.devices import devicePathToName, PartitionDevice
> +from storage.devices import deviceNameToDiskByPath, deviceNameToWWID
> +from storage.errors import DeviceNotFoundError
> 
>  import gettext
>  _ = lambda x: gettext.ldgettext("anaconda", x)
> @@ -963,6 +967,19 @@ class PartitionWindow(InstallWindow):
>          # device name
>          name_str = getattr(device, "lvname", device.name)
> 
> +        try:
> +            if iutil.isS390() and \
> +               (name_str.startswith("dasd") or \
> +                name_str.startswith("sd")):

I guess we can also get here with LVM logical volumes of which the user
could have created some with arbitrary names, e.g. starting with "dasd"
or "sd". So this string prefix check might turn out fragile.

Can we access the storage class objects and simply use the safe
udev_device_is_dasd and udev_device_is_zfcp and then
udev_device_get_path or udev_device_get_wwid as Chris does for
iw/filter_gui.py?

> +                name_str = os.path.basename(deviceNameToDiskByPath(name_str))
> +            elif name_str.startswith("mpath"):
> +                name_str = deviceNameToWWID(name_str)
> +        except DeviceNotFoundError:
> +            name_str = device.name
> +
> +        if name_str == "":
> +            name_str = device.name
> +
>          # label
>          label_str = getattr(format, "label", "")
>          if label_str is None:
> diff --git a/storage/devices.py b/storage/devices.py
> index 7e7e405..6104fd7 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -160,6 +160,22 @@ def deviceNameToDiskByPath(deviceName=None):
>          return ret
>      raise DeviceNotFoundError(deviceName)
> 
> +
> +def deviceNameToWWID(deviceName=None):
> +    if not deviceName:
> +        return ""
> +
> +    ret = None
> +    for dev in udev_get_block_devices():
> +        if udev_device_get_name(dev) == deviceName:
> +            ret = udev_device_get_wwid(dev)
> +            break
> +
> +    if ret:
> +        return ret
> +    raise DeviceNotFoundError(deviceName)
> +
> +
>  class Device(object):
>      """ A generic device.
> 

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
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