From: "Brian C. Lane" bcl@redhat.com
Treat a disk with a disklabel but no partitions the same as an uninitialized disk. --- pyanaconda/storage/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 8df216e..4316e1b 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -694,6 +694,10 @@ class Storage(object): return None
def shouldClear(self, device, **kwargs): + def empty_disk(): + return bool(device.format.type is None or \ + len(self.devicetree.getChildren(device)) == 0) + clearPartType = kwargs.get("clearPartType", self.config.clearPartType) clearPartDisks = kwargs.get("clearPartDisks", self.config.clearPartDisks) @@ -720,11 +724,11 @@ class Storage(object): return False
# the only devices we want to clear when clearPartType is - # CLEARPART_TYPE_NONE are uninitialized disks in clearPartDisks, and - # then only when we have been asked to initialize disks as needed + # CLEARPART_TYPE_NONE are uninitialized disks in clearPartDisks, + # disks with no partitions and then only when we have been asked + # to initialize disks as needed if clearPartType in [CLEARPART_TYPE_NONE, None] and \ - not (device.isDisk and device.format.type is None and - self.config.initializeDisks): + not (device.isDisk and empty_disk() and self.config.initializeDisks): return False
if isinstance(device, PartitionDevice):