[PATCH 1/2] Adjust remaining PartitionDevices' names after removing a partition.

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

 



Since parted renames/renumbers partitions, we need to update the names
of the PartitionDevice instances so that they are in sync with the parted
Partition.
---
 storage/devicetree.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 1af24c3..63fc18b 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -713,6 +713,14 @@ class DeviceTree(object):
 
             dev.disk.partedDisk.removePartition(dev.partedPartition)
 
+            # adjust all other PartitionDevice instances belonging to the
+            # same disk so the device name matches the potentially altered
+            # name of the parted.Partition
+            for device in self._devices:
+                if isinstance(device, PartitionDevice) and \
+                   device.disk == dev.disk:
+                    device.updateName()
+
         self._devices.remove(dev)
         log.debug("removed %s (%s) from device tree" % (dev.name,
                                                         dev.type))
-- 
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