[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH master, f14-branch] Clearing of formatting from unpartitioned disks belongs in clearPartitions.



Ack.

On 08/11/2010 07:38 PM, David Lehman wrote:
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)

@@ -441,25 +460,6 @@ def removeEmptyExtendedPartitions(storage):
              storage.destroyDevice(extended)
              #disk.partedDisk.removePartition(extended.partedPartition)

-    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.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]