[PATCH 3/4] Fix a bug extended partition management. (#951765)

David Lehman dlehman at redhat.com
Mon Apr 22 15:14:57 UTC 2013


This bug was introduced/revealed by commit 1b53e3fb3d9b23422.

We can't destroy the extended since there is a logical on that disk, so
we need to update that extended's partedPartition first/instead. Also, by
updating the already-defined PartitionDevice representing the extended
first, we save some unneeded destroy/create action pairs.
---
 blivet/partitioning.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 9d3c602..8660969 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -676,6 +676,12 @@ def updateExtendedPartitions(storage, disks):
             continue
 
         extendedName = devicePathToName(extended.getDeviceNodeName())
+        device = storage.devicetree.getDeviceByName(extendedName)
+        if device:
+            if not device.exists:
+                # created by us, update partedPartition
+                device.partedPartition = extended
+
         # remove any obsolete extended partitions
         for part in storage.partitions:
             if part.disk == disk and part.isExtended and \
@@ -685,11 +691,7 @@ def updateExtendedPartitions(storage, disks):
                 else:
                     storage.devicetree._removeDevice(part, moddisk=False)
 
-        device = storage.devicetree.getDeviceByName(extendedName)
         if device:
-            if not device.exists:
-                # created by us, update partedPartition
-                device.partedPartition = extended
             continue
 
         # This is a little odd because normally instantiating a partition
-- 
1.8.1.4



More information about the anaconda-patches mailing list