[PATCH] Initialize disks with no partitions (#864360)
Brian C. Lane
bcl at redhat.com
Sat Oct 13 00:00:43 UTC 2012
From: "Brian C. Lane" <bcl at 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):
--
1.7.11.4
More information about the anaconda-patches
mailing list