Bug 516168

Summary: Traceback while initializing disks
Product: [Fedora] Fedora Reporter: Jesse Keating <jkeating>
Component: anacondaAssignee: Hans de Goede <hdegoede>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dcantrell, hdegoede, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: anaconda_trace_hash:5e082969ea0041538f066ab6821b9b90d2efe9760d06896c47910047e49b6e50
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-11 18:41:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 507676    
Attachments:
Description Flags
Attached traceback automatically from anaconda. none

Description Jesse Keating 2009-08-07 05:47:55 UTC
The following was filed automatically by anaconda:
anaconda 12.10 exception report
Traceback (most recent call first):
  File "/usr/lib/anaconda/storage/udev.py", line 170, in udev_device_get_sysfs_path
    return info['sysfs_path']
  File "/usr/lib/anaconda/storage/devicetree.py", line 1196, in addUdevDevice
    sysfs_path = udev_device_get_sysfs_path(info)
  File "/usr/lib/anaconda/storage/devicetree.py", line 1089, in addUdevPartitionDevice
    self.addUdevDevice(new_info)
  File "/usr/lib/anaconda/storage/devicetree.py", line 1259, in addUdevDevice
    device = self.addUdevPartitionDevice(info)
  File "/usr/lib/anaconda/storage/devicetree.py", line 1864, in populate
    self.addUdevDevice(dev)
  File "/usr/lib/anaconda/storage/__init__.py", line 293, in reset
    self.devicetree.populate()
  File "/usr/lib/anaconda/storage/__init__.py", line 92, in storageInitialize
    storage.reset()
  File "/usr/lib/anaconda/dispatch.py", line 204, in moveStep
    rc = stepFunc(self.anaconda)
  File "/usr/lib/anaconda/dispatch.py", line 127, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/gui.py", line 1201, in nextClicked
    self.anaconda.dispatch.gotoNext()
  File "/usr/lib/anaconda/gui.py", line 1331, in keyRelease
    self.nextClicked()
KeyError: 'sysfs_path'

Comment 1 Jesse Keating 2009-08-07 05:48:00 UTC
Created attachment 356622 [details]
Attached traceback automatically from anaconda.

Comment 2 Hans de Goede 2009-08-07 12:34:26 UTC
Ok,

So this is not as generic a bug as you think, something weird is going on,
from the log:

[2009-07-29 19:36:06,011]     INFO: devices to scan: ['sda1', 'sda2', 'sdb1', 'sr0', 'sda', 'sdb']
[2009-07-29 19:36:06,257]    DEBUG: scanning sda1 (/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0/block/sda/sda1)...
[2009-07-29 19:36:06,258]    DEBUG: looking for device 'sda1'...
[2009-07-29 19:36:06,258]    DEBUG: found None
[2009-07-29 19:36:06,259]    DEBUG: sda1 is a partition
[2009-07-29 19:36:06,262]    DEBUG: looking for device 'sda'...
[2009-07-29 19:36:06,263]    DEBUG: found None
[2009-07-29 19:36:06,264]    DEBUG: /devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0/block/sda does not exist

So it begins with scanning sda1, then cannot find the disk in the devicetree
at it has not been scanned yet (all fine) and then it errors out with:

[2009-07-29 19:36:06,264]    DEBUG: /devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0/block/sda does not exist

Which is the beginning of the end.

Comment 3 Hans de Goede 2009-08-07 12:49:26 UTC
Hmm, ok, I take that back the issue does seem to be as generic as you think, digging deeper ...

Ok so the problem is that the find the disk and add it to the tree code in
addUdevPartitionDevice() passes a sysfs path without /sys/ prefixed to
udev_get_block_device()

Where as udev_get_block_device() expects a path prefixed with /sys/.

This was a pre-existing problem before the recent udev handling changes clumens did, but before these changes, udev_get_block_device() would just return
None in this case, leading to:

            if disk is None:
                # if the current device is still not in
                # the tree, something has gone wrong
                log.error("failure scanning device %s" % disk_name)
                return  

So if a partition was scanned before a disk we would ignore it. In the new udev code however we have:

    dev = udev_get_device(sysfs_path)
    if not dev or not dev.has_key("name"):
        return {"name": None, "symlinks": []}
    else:
        return dev

So  udev_get_block_device() is no longer returning None due to the wrong sysfs path, and therefor we now backtrace.

I'll send a patch to the list fixing the sysfs path issue.


p.s.

This does expose a deeper problem, just like had some places in the old storage code which expected /dev/sda and others which expected just sda, we seem to have done the same now with /sys. udev_device_get_sysfs_path() returns 
a path without the /sys prefix, where as udev_get_block_device expects a path
prefixed with /sys. This seems like something which we ought to fix.

Comment 4 Hans de Goede 2009-08-07 13:52:29 UTC
Status upd: a patch for this has been send to the list.

Comment 5 Hans de Goede 2009-08-07 14:46:03 UTC
This is fixed by this commit:
http://git.fedorahosted.org/git/?p=anaconda.git;a=commitdiff;h=2694e31a34d7f89ab84d59fbdfcffd3986cc1fcb

Which will be in 12.11

Comment 6 Jesse Keating 2009-08-11 18:41:12 UTC
Confirmed fixed in rawhide.