Bug 1095329

Summary: AttributeError: 'NoneType' object has no attribute 'sectorSize'
Product: [Fedora] Fedora Reporter: Igor Gnatenko <ignatenko>
Component: python-blivetAssignee: mulhern <amulhern>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: amulhern, anaconda-maint-list, bcl, dlehman, g.kaviyarasu, jonathan, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:d1a9b7a33c68dabe031ee2ce255607ec337463dcfb1db8eee57ee3e687e76b45
Fixed In Version: python-blivet-0.53 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-23 15:35:43 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:
Attachments:
Description Flags
File: anaconda-tb
none
File: anaconda.log
none
File: environ
none
File: lsblk_output
none
File: nmcli_dev_list
none
File: os_info
none
File: program.log
none
File: storage.log
none
File: syslog
none
File: ifcfg.log
none
File: packaging.log none

Description Igor Gnatenko 2014-05-07 13:16:51 UTC
Version-Release number of selected component:
anaconda-21.35-1

The following was filed automatically by anaconda:
anaconda 21.35-1 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.7/site-packages/blivet/formats/disklabel.py", line 127, in dict
    "sectorSize": self.partedDevice.sectorSize,
  File "/usr/lib/python2.7/site-packages/blivet/devices.py", line 701, in dict
    "format": self.format.dict, "removable": self.removable,
  File "/usr/lib/python2.7/site-packages/blivet/__init__.py", line 1694, in dumpState
    shelf[key] = [d.dict for d in self.devices]
  File "/usr/lib/python2.7/site-packages/blivet/__init__.py", line 371, in doIt
    self.dumpState("final")
  File "/usr/lib/python2.7/site-packages/blivet/__init__.py", line 170, in turnOnFilesystems
    storage.doIt()
  File "/usr/lib64/python2.7/site-packages/pyanaconda/install.py", line 167, in doInstall
    turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
  File "/usr/lib64/python2.7/threading.py", line 766, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 227, in run
    threading.Thread.run(self, *args, **kwargs)
AttributeError: 'NoneType' object has no attribute 'sectorSize'

Additional info:
cmdline:        /usr/bin/python  /sbin/anaconda
cmdline_file:   repo=http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/ initrd=http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/images/pxeboot/initrd.img BOOT_IMAGE=http://download.fedoraproject.org/pub/fedora/linux/development/rawhide/x86_64/os/images/pxeboot/vmlinuz 
executable:     /sbin/anaconda
hashmarkername: anaconda
kernel:         3.15.0-0.rc4.git1.1.fc21.x86_64
product:        Fedora
release:        Cannot get release name.
type:           anaconda
version:        rawhide

Comment 1 Igor Gnatenko 2014-05-07 13:16:56 UTC
Created attachment 893261 [details]
File: anaconda-tb

Comment 2 Igor Gnatenko 2014-05-07 13:16:59 UTC
Created attachment 893262 [details]
File: anaconda.log

Comment 3 Igor Gnatenko 2014-05-07 13:17:02 UTC
Created attachment 893263 [details]
File: environ

Comment 4 Igor Gnatenko 2014-05-07 13:17:05 UTC
Created attachment 893264 [details]
File: lsblk_output

Comment 5 Igor Gnatenko 2014-05-07 13:17:07 UTC
Created attachment 893265 [details]
File: nmcli_dev_list

Comment 6 Igor Gnatenko 2014-05-07 13:17:10 UTC
Created attachment 893266 [details]
File: os_info

Comment 7 Igor Gnatenko 2014-05-07 13:17:12 UTC
Created attachment 893267 [details]
File: program.log

Comment 8 Igor Gnatenko 2014-05-07 13:17:17 UTC
Created attachment 893268 [details]
File: storage.log

Comment 9 Igor Gnatenko 2014-05-07 13:17:21 UTC
Created attachment 893269 [details]
File: syslog

Comment 10 Igor Gnatenko 2014-05-07 13:17:24 UTC
Created attachment 893270 [details]
File: ifcfg.log

Comment 11 Igor Gnatenko 2014-05-07 13:17:27 UTC
Created attachment 893271 [details]
File: packaging.log

Comment 12 mulhern 2014-05-08 13:14:34 UTC
There are two things that seem wrong here:

1) dumpState() is allowing this exception to propagate. It should catch and log at least all AttributeErrors.
2) Disklabel.dict() should not assume that partedDevice has been set, since the property explicitly allows None. labelType, partitions, and alignment are all properties which handle a missing partedDevice somehow. sectorSize() should be a property as well, since it is used in both dict() and __repr__().

No other problems are immediately obvious.

Comment 13 mulhern 2014-05-08 14:28:51 UTC
Note that many of the attributes listed rely on partedDisk, itself a property.

If partedDevice is None, partedDisk will propagate a parted.DiskException. This seems like the correct behavior.

Note that in this particular case partedDevice is None because there was an error when reading OpticalDevice /dev/sr0 "No medium found"

Comment 14 mulhern 2014-05-08 17:00:25 UTC
If no media can be found on the OpticalDevice then it should have the default format corresponding to None, not a Disklabel format, and so the code that actually throws the exception should not be executing. So there is an underlying bug.

The problem is that DeviceTree.updateDeviceFormat() is be invoked by anaconda, and it has no safeguards to prevent putting a format on the device if no media is present. In addUdevDevice() the safeguard exists.
Since handleUdevDeviceFormat is only called from these two places, it seems reasonable to put the safeguards in that method.

Comment 15 mulhern 2014-05-08 19:36:55 UTC
Reposted.

Comment 16 Jaroslav Reznik 2015-03-03 17:13:31 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22