[PATCH 2/3] Fix partition handling across multiple processActions calls. (#1065522)

David Lehman dlehman at redhat.com
Thu Feb 20 18:07:03 UTC 2014


We replace the parted.Disk instances in all DiskLabel instances every
time processActions is run, so we need update the parted.Partition
instances throughout the devicetree accordingly.

Also, we have to make sure that each DiskLabel's _origPartedDisk is
updated before we update the DiskDevice's originalFormat with a new
copy of the DiskLabel.
---
 blivet/devicetree.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index ef4f8ab..2b75043 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -281,8 +281,15 @@ class DeviceTree(object):
         # removal of partitions makes use of originalFormat, so it has to stay
         # up to date in case of multiple passes through this method
         for disk in (d for d in self.devices if d.partitioned):
+            disk.format.updateOrigPartedDisk()
             disk.originalFormat = copy.deepcopy(disk.format)
 
+        # now we have to update the parted partitions of all devices so they
+        # match the parted disks we just updated
+        for partition in self.getDevicesByInstance(PartitionDevice):
+            pdisk = partition.disk.format.partedDisk
+            partition.partedPartition = pdisk.getPartitionByPath(partition.path)
+
     def _addDevice(self, newdev):
         """ Add a device to the tree.
 
-- 
1.8.5.3



More information about the anaconda-patches mailing list