[PATCH 6/8] Remove partitions from all appropriate DiskLabel instances. (#870586)

David Lehman dlehman at redhat.com
Thu Nov 29 17:19:30 UTC 2012


Now that StorageDevice's format and originalFormat attributes are
distinct instances of a DeviceFormat class we have to explicitly
duplicate partition removals when we aren't reinitializing the disklabel.
All removals are currently done on originalFormat and format still has
all of its original partitions, which becomes a problem when we try
to add new ones to it.
---
 pyanaconda/storage/devices.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index e465c2d..6967b30 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -1540,6 +1540,13 @@ class PartitionDevice(StorageDevice):
             self.partedPartition = self.disk.originalFormat.partedDisk.getPartitionByPath(self.path)
             raise
 
+        if self.disk.format.exists:
+            # If the new/current disklabel is the same as the original one, we
+            # have to duplicate the removal on the other copy of the DiskLabel.
+            part = self.disk.format.partedDisk.getPartitionByPath(self.path)
+            self.disk.format.removePartition(part)
+            self.disk.format.commit()
+
     def deactivate(self):
         """
         This is never called. For instructional purposes only.
-- 
1.7.7.6



More information about the anaconda-patches mailing list