Originally filed for RHEL-5. I posted a patch earlier and Steffen Maier commented on it saying it would be useful to have more information for the drive in question, especially if you have a large number of the same type in the system.
The dialog box could probably be improved, but I'm mostly just going for functionality with this patch. In addition to displaying the device model string and the size in megabytes (as originally requested in the BZ), I added a device details string if we can find it in /dev/disk/by-path on the system. Example output on my system:
Error processing drive sda 305243MB (ATA ST3320620AS).
Maybe it needs to be reinitialized. YOU WILL LOSE ALL DATA ON THIS DRIVE IN YOUR REINITIALIZE IT!
Device details: pci-0000:00:1f.2-scsi-0:0:0:0
For DASD and zFCP, you'll get a slightly different clown barf string for the device details.
I think the dialog wording could be improved, but since Peter and Andy are working on error string cleanups, I would like to leave that to them.
When a partition table is unreadable, anaconda displays a window explaining the situation and asks you if you would like to format the disk for use. The existing message would only give the device node name (e.g., /dev/sda47). This patch adds the drive model name and capacity to the message so confused users might know which disk anaconda is talking about. --- storage/devicetree.py | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/storage/devicetree.py b/storage/devicetree.py index b856c6c..41a8093 100644 --- a/storage/devicetree.py +++ b/storage/devicetree.py @@ -126,10 +126,24 @@ def questionInitializeDisk(intf=None, name=None): if not intf or not name: pass else: + if not name.startswith('/dev/'): + devpath = '/dev/' + name + else: + devpath = name + + dev = parted.getDevice(devpath) + bypath = deviceNameToDiskByPath(name) + details = "" + + if bypath: + details = "\n\nDevice details:\n%s" % (bypath,) + rc = intf.messageWindow(_("Warning"), - _("Error processing drive %s.\n" - "Maybe it needs to be reinitialized. " - "YOU WILL LOSE ALL DATA ON THIS DRIVE!") % (name,), + _("Error processing drive %s %-0.fMB (%s).\n\n" + "Maybe it needs to be reinitialized. YOU " + "WILL LOSE ALL DATA ON THIS DRIVE IF YOU " + "REINITIALIZE IT!%s") + % (name, dev.getSize(), dev.model, details,), type="custom", custom_buttons = [ _("_Ignore drive"), _("_Re-initialize drive") ],
This function takes a device name (e.g., sda) and returns the link name that it matches in /dev/disk/by-path. Used to help people with many similar named devices (hundreds of DASDs, for example). --- storage/devices.py | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/storage/devices.py b/storage/devices.py index b46479b..a70c667 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -143,6 +143,23 @@ def devicePathToName(devicePath): return name
+def deviceNameToDiskByPath(deviceName=None): + bypath = '/dev/disk/by-path' + + if not deviceName: + return "" + + if not os.path.isdir(bypath): + return "" + + for path in os.listdir(bypath): + target = os.path.basename(os.readlink(bypath + '/' + path)) + if target == deviceName: + return path + + return "" + + class Device(object): """ A generic device.
Hi,
Both look good to me,
Regards,
Hans
On 07/10/2009 10:22 PM, David Cantrell wrote:
Originally filed for RHEL-5. I posted a patch earlier and Steffen Maier commented on it saying it would be useful to have more information for the drive in question, especially if you have a large number of the same type in the system.
The dialog box could probably be improved, but I'm mostly just going for functionality with this patch. In addition to displaying the device model string and the size in megabytes (as originally requested in the BZ), I added a device details string if we can find it in /dev/disk/by-path on the system. Example output on my system:
Error processing drive sda 305243MB (ATA ST3320620AS). Maybe it needs to be reinitialized. YOU WILL LOSE ALL DATA ON THIS DRIVE IN YOUR REINITIALIZE IT! Device details: pci-0000:00:1f.2-scsi-0:0:0:0
For DASD and zFCP, you'll get a slightly different clown barf string for the device details.
I think the dialog wording could be improved, but since Peter and Andy are working on error string cleanups, I would like to leave that to them.
anaconda-devel@lists.fedoraproject.org