Re: [master&rhel6-branch] Show by-path names for DASD and zFCP, WWID for mpath (#580507)

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

 



Ack.  I have applied this with minor changes (I do not like the use of
.replace and prefer os.path.basename instead).

On Thu, 3 Jun 2010, Steffen Maier 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 by-path
identifiers are more useful to s390 users, so display those on this
screen if we have them, otherwise fall back on the device path.

For mpath devices, try to display the WWID if we have it, otherwise show
the device path.

(Based on patch from David Cantrell <dcantrell@xxxxxxxxxx>)
---
iw/partition_gui.py |   19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index be179dc..3773c5e 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -50,6 +50,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
+from storage.errors import DeviceNotFoundError

import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -1090,15 +1092,28 @@ class PartitionWindow(InstallWindow):
                # whole-disk formatting
                self.addDevice(disk, parent)

+            ident = None
+            try:
+                if disk.type == "dasd" or disk.type == "zfcp":
+                    ident = deviceNameToDiskByPath(disk.name)
+                    if ident.startswith("/dev/disk/by-path/"):
+                        ident = ident.replace("/dev/disk/by-path/", "")
+                elif disk.type == "dm-multipath":
+                    ident = disk.wwid
+            except DeviceNotFoundError:
+                ident = None
+            if not ident:
+                ident = disk.path
+
            # Insert a '\n' when device string is too long.  Usually when it
            # contains '/dev/mapper'.  First column should be around 20 chars.
-            if len(disk.name) + len(disk.path) > 20:
+            if len(disk.name) + len(ident) > 20:
                separator = "\n"
            else:
                separator= " "
            self.tree[parent]['Device'] = \
                    "%s%s<span size=\"small\" color=\"gray\">(%s)</span>" \
-                    % (disk.name, separator, disk.path)
+                    % (disk.name, separator, ident)

        self.treeView.expand_all()
        self.messageGraph.display()


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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