[PATCH 1/5] Clean up management of extended partitions we create. (#497293)

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

 



---
 storage/devicetree.py   |    8 ++++++++
 storage/partitioning.py |   14 +++++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 8dedfa6..886c69f 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -676,6 +676,14 @@ class DeviceTree(object):
             log.debug("cmp: %d -- %s | %s" % (ret, a1, a2))
             return ret
 
+        # setup actions to create any extended partitions we added
+        for device in self.devices:
+            if isinstance(device, PartitionDevice) and \
+               device.isExtended and not device.exists:
+                # don't properly register the action since the device is
+                # already in the tree
+                self._actions.append(ActionCreateDevice(device))
+
         for action in self._actions:
             log.debug("action: %s" % action)
 
diff --git a/storage/partitioning.py b/storage/partitioning.py
index 65c1f5d..e44d7f4 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -603,9 +603,19 @@ def doPartitioning(storage, exclusiveDisks=None):
     for disk in disks:
         extended = disk.format.extendedPartition
         if not extended:
+            # remove any obsolete extended partitions
+            for part in storage.partitions:
+                if part.disk == disk and part.isExtended:
+                    storage.devicetree._removeDevice(part, moddisk=False)
             continue
 
         extendedName = devicePathToName(extended.getDeviceNodeName())
+        # remove any obsolete extended partitions
+        for part in storage.partitions:
+            if part.disk == disk and part.isExtended and \
+               part.name != extendedName:
+                storage.devicetree._removeDevice(part, moddisk=False)
+
         device = storage.devicetree.getDeviceByName(extendedName)
         if device:
             if not device.exists:
@@ -620,7 +630,9 @@ def doPartitioning(storage, exclusiveDisks=None):
         device = PartitionDevice(extendedName, parents=disk)
         device.parents = [disk]
         device.partedPartition = extended
-        storage.createDevice(device)
+        # just add the device for now -- we'll handle actions at the last
+        # moment to simplify things
+        storage.devicetree._addDevice(device)
 
 def allocatePartitions(disks, partitions):
     """ Allocate partitions based on requested features.
-- 
1.6.0.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux