diff options
author | David Lehman <dlehman@redhat.com> | 2009-08-14 16:52:47 -0500 |
---|---|---|
committer | David Lehman <dlehman@redhat.com> | 2009-08-17 17:02:58 -0500 |
commit | a2a7d4839610afcb6ab532da04a835156384a419 (patch) | |
tree | 5204f0f8676f2552e61ef200c282d60c57210fc6 | |
parent | dc3cba5f8de8871f68143d256858af9ee3865844 (diff) | |
download | anaconda-a2a7d4839610afcb6ab532da04a835156384a419.tar.gz anaconda-a2a7d4839610afcb6ab532da04a835156384a419.tar.xz anaconda-a2a7d4839610afcb6ab532da04a835156384a419.zip |
Clean up management of extended partitions we create. (#497293)
-rw-r--r-- | storage/devicetree.py | 8 | ||||
-rw-r--r-- | storage/partitioning.py | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/storage/devicetree.py b/storage/devicetree.py index 8ecf81530..83d756ba9 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 65c1f5dcc..e44d7f4d4 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. |