[PATCH 3/5] Handle changes to sizes of predefined devices in custom spoke.

David Lehman dlehman at redhat.com
Thu Sep 6 22:02:56 UTC 2012


---
 pyanaconda/ui/gui/spokes/custom.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 3d325cb..2604b36 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -307,6 +307,13 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
         partition_creates = [a for a in actions if a.device.type == "partition"]
         self._propagate_actions(partition_creates)
 
+        # catch changed size of partitions defined prior to this visit
+        for ui_device in self.__storage.partitions:
+            device = self.storage.devicetree.getDeviceByID(ui_device.id)
+            if device and not device.exists and ui_device.size != device.size:
+                device.req_base_size = ui_device.req_base_size
+                device.req_size = ui_device.req_size
+
         if partition_creates or partition_destroys:
             try:
                 doPartitioning(self.storage)
@@ -314,6 +321,17 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                 # TODO: error handling
                 raise
 
+        # catch changed size of non-partition devices defined prior to this
+        # visit
+        for ui_device in self.__storage.devices:
+            if ui_device in self.__storage.partitions:
+                # did partitions before doPartitioning
+                continue
+
+            device = self.storage.devicetree.getDeviceByID(ui_device.id)
+            if device and not device.exists and ui_device.size != device.size:
+                device._size = ui_device._size
+
         # register all other create actions
         already_handled = disklabel_creates + partition_creates
         actions = [a for a in ui_devicetree.findActions(type="create")
-- 
1.7.7.6



More information about the anaconda-patches mailing list