Clearing of formatting from unpartitioned disks belongs in clearPartitions.
It ended up in removeEmptyExtendedPartitions somehow, but it doesn't belong
there.
---
pyanaconda/storage/partitioning.py | 38 ++++++++++++++++++------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index af42a03..a655d0d 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -386,6 +386,25 @@ def clearPartitions(storage):
log.debug("partitions: %s" % [p.getDeviceNodeName() for p in part.partedPartition.disk.partitions])
storage.destroyDevice(part)
+ for disk in [d for d in storage.disks if d not in storage.partitioned]:
+ # clear any whole-disk formats that need clearing
+ if shouldClear(disk, storage.clearPartType, storage.clearPartDisks):
+ log.debug("clearing %s" % disk.name)
+ devices = storage.deviceDeps(disk)
+ while devices:
+ log.debug("devices to remove: %s" % ([d.name for d in devices],))
+ leaves = [d for d in devices if d.isleaf]
+ log.debug("leaves to remove: %s" % ([d.name for d in leaves],))
+ for leaf in leaves:
+ storage.destroyDevice(leaf)
+ devices.remove(leaf)
+
+ destroy_action = ActionDestroyFormat(disk)
+ newLabel = getFormat("disklabel", device=disk.path)
+ create_action = ActionCreateFormat(disk, format=newLabel)
+ storage.devicetree.registerAction(destroy_action)
+ storage.devicetree.registerAction(create_action)
+
# now remove any empty extended partitions
removeEmptyExtendedPartitions(storage)
- for disk in [d for d in storage.disks if d not in storage.partitioned]:
- # clear any whole-disk formats that need clearing
- if shouldClear(disk, storage.clearPartType, storage.clearPartDisks):
- log.debug("clearing %s" % disk.name)
- devices = storage.deviceDeps(disk)
- while devices:
- log.debug("devices to remove: %s" % ([d.name for d in devices],))
- leaves = [d for d in devices if d.isleaf]
- log.debug("leaves to remove: %s" % ([d.name for d in leaves],))
- for leaf in leaves:
- storage.destroyDevice(leaf)
- devices.remove(leaf)
-
- destroy_action = ActionDestroyFormat(disk)
- newLabel = getFormat("disklabel", device=disk.path)
- create_action = ActionCreateFormat(disk, format=newLabel)
- storage.devicetree.registerAction(destroy_action)
- storage.devicetree.registerAction(create_action)
-
def partitionCompare(part1, part2):
""" More specifically defined partitions come first.
--
1.7.1.1
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list