[PATCH 3/4] Handle partition removals regardless of deepcopy. (#884896)
David Lehman
dlehman at redhat.com
Fri Dec 7 22:45:11 UTC 2012
A StorageDevice containing a DiskLabel will have both an originalFormat
and a format attribute, both of which are DiskLabel instances. They are
copied using a shallow copy, so they share _partedDisk and _origPartedDisk
attributes. That means you only have to do partition removals from the
parted Disk once.
When you make a deep copy of such a StorageDevice, things change. The
originalFormat and format no longer share a single _partedDisk or
_origPartedDisk. In this case, it is sometimes necessary to remove
a partition from both self.disk.format and self.disk.originalFormat.
---
pyanaconda/storage/devices.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 06baab2..90956f4 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -1540,7 +1540,8 @@ class PartitionDevice(StorageDevice):
self.partedPartition = self.disk.originalFormat.partedDisk.getPartitionByPath(self.path)
raise
- if self.disk.format.exists:
+ if self.disk.format.exists and \
+ self.disk.format.partedDisk != self.disk.originalFormat.partedDisk:
# 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)
--
1.7.7.6
More information about the anaconda-patches
mailing list