Both patches are only for master.
Patch 1 does what it says it does.
Patch 2 prevents crashes when the cacheMajorMinor function is called on new formats whose device attr is not yet set (by setting it earlier).
Related: rhbz#701228 --- pyanaconda/bootloader.py | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index 1f7c2fd..7fc5f61 100644 --- a/pyanaconda/bootloader.py +++ b/pyanaconda/bootloader.py @@ -577,6 +577,10 @@ class BootLoader(object): self.errors = [] self.warnings = [] valid = True + + if device is None: + return False + try: description = self.device_description(device) except Exception: @@ -686,6 +690,9 @@ class BootLoader(object): self.warnings = [] valid = True
+ if device is None: + return False + if not self._device_type_match(device, self.stage2_device_types): self.errors.append(_("The %s cannot be of type %s") % (self.stage2_description, device.type)) @@ -1482,6 +1489,10 @@ class GRUB2(GRUB): # def _gpt_disk_has_bios_boot(self, device): ret = False + + if device is None: + return ret + # check that a bios boot partition is present if the stage1 device # is a gpt-labeled disk if device.isDisk and getattr(device.format, "labelType", None) == "gpt":
--- pyanaconda/storage/__init__.py | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 209fbdc..f92c040 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -820,7 +820,9 @@ class Storage(object): else: name = "req%d" % self.nextID
- return PartitionDevice(name, *args, **kwargs) + device = PartitionDevice(name, *args, **kwargs) + device.format.device = device.path + return device
def newMDArray(self, *args, **kwargs): """ Return a new MDRaidArrayDevice instance for configuring. """ @@ -839,7 +841,9 @@ class Storage(object): else: name = "md%d" % kwargs["minor"]
- return MDRaidArrayDevice(name, *args, **kwargs) + device = MDRaidArrayDevice(name, *args, **kwargs) + device.format.device = device.path + return device
def newVG(self, *args, **kwargs): """ Return a new LVMVolumeGroupDevice instance. """ @@ -885,7 +889,9 @@ class Storage(object): if name in [d.name for d in self.devices]: raise ValueError("name already in use")
- return LVMLogicalVolumeDevice(name, vg, *args, **kwargs) + device = LVMLogicalVolumeDevice(name, vg, *args, **kwargs) + device.format.device = device.path + return device
def createDevice(self, device): """ Schedule creation of a device.
On Wed, May 18, 2011 at 11:29:29AM -0500, David Lehman wrote:
pyanaconda/storage/__init__.py | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 209fbdc..f92c040 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -820,7 +820,9 @@ class Storage(object): else: name = "req%d" % self.nextID
return PartitionDevice(name, *args, **kwargs)
device = PartitionDevice(name, *args, **kwargs)
device.format.device = device.path
return device
def newMDArray(self, *args, **kwargs): """ Return a new MDRaidArrayDevice instance for configuring. """
@@ -839,7 +841,9 @@ class Storage(object): else: name = "md%d" % kwargs["minor"]
return MDRaidArrayDevice(name, *args, **kwargs)
device = MDRaidArrayDevice(name, *args, **kwargs)
device.format.device = device.path
return device
def newVG(self, *args, **kwargs): """ Return a new LVMVolumeGroupDevice instance. """
@@ -885,7 +889,9 @@ class Storage(object): if name in [d.name for d in self.devices]: raise ValueError("name already in use")
return LVMLogicalVolumeDevice(name, vg, *args, **kwargs)
device = LVMLogicalVolumeDevice(name, vg, *args, **kwargs)
device.format.device = device.path
return device
def createDevice(self, device): """ Schedule creation of a device.
-- 1.7.3.4
If this attribute is something that is going to need to be setup every time the class is used it should be done in the __init__ and not something the caller needs to know how to setup.
On Tue, 2011-05-24 at 09:16 -0700, Brian C. Lane wrote:
On Wed, May 18, 2011 at 11:29:29AM -0500, David Lehman wrote:
pyanaconda/storage/__init__.py | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 209fbdc..f92c040 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -820,7 +820,9 @@ class Storage(object): else: name = "req%d" % self.nextID
return PartitionDevice(name, *args, **kwargs)
device = PartitionDevice(name, *args, **kwargs)
device.format.device = device.path
return device
def newMDArray(self, *args, **kwargs): """ Return a new MDRaidArrayDevice instance for configuring. """
@@ -839,7 +841,9 @@ class Storage(object): else: name = "md%d" % kwargs["minor"]
return MDRaidArrayDevice(name, *args, **kwargs)
device = MDRaidArrayDevice(name, *args, **kwargs)
device.format.device = device.path
return device
def newVG(self, *args, **kwargs): """ Return a new LVMVolumeGroupDevice instance. """
@@ -885,7 +889,9 @@ class Storage(object): if name in [d.name for d in self.devices]: raise ValueError("name already in use")
return LVMLogicalVolumeDevice(name, vg, *args, **kwargs)
device = LVMLogicalVolumeDevice(name, vg, *args, **kwargs)
device.format.device = device.path
return device
def createDevice(self, device): """ Schedule creation of a device.
-- 1.7.3.4
If this attribute is something that is going to need to be setup every time the class is used it should be done in the __init__ and not something the caller needs to know how to setup.
Good idea. I'll send patches soon to set formats' device attr in StorageDevice._setFormat and revert this one.
Dave
Anaconda-devel-list mailing list Anaconda-devel-list@redhat.com https://www.redhat.com/mailman/listinfo/anaconda-devel-list
On 05/18/2011 06:29 PM, David Lehman wrote:
Both patches are only for master.
Patch 1 does what it says it does.
Patch 2 prevents crashes when the cacheMajorMinor function is called on new formats whose device attr is not yet set (by setting it earlier).
Both look good.
Ales
anaconda-devel@lists.stg.fedoraproject.org