[PATCH] Fix autopart shrink of existing system. (#746605)

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

 



I broke this with commit 10832b8f225dfdd93a5d83e6ef7315c2a24feb1d.

Also, PartitionDevice.targetSize starts out at zero, which meant
that canceling resize actions on partitions always failed.
---
 pyanaconda/iw/autopart_type.py     |    2 +-
 pyanaconda/storage/deviceaction.py |    6 +++++-
 pyanaconda/storage/partitioning.py |    6 +++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/iw/autopart_type.py b/pyanaconda/iw/autopart_type.py
index 536adcc..d4ee6cb 100644
--- a/pyanaconda/iw/autopart_type.py
+++ b/pyanaconda/iw/autopart_type.py
@@ -169,7 +169,7 @@ class PartitionTypeWindow(InstallWindow):
                         path = action.device.path
                         size = action.device.targetSize
                         self.storage.shrinkPartitions[path] = size
-                        self.storage.devicetree.cancelAction(action)
+                        action.cancel()
                 else:
                     raise gui.StayOnScreen
 
diff --git a/pyanaconda/storage/deviceaction.py b/pyanaconda/storage/deviceaction.py
index 0a15499..7b91dc7 100644
--- a/pyanaconda/storage/deviceaction.py
+++ b/pyanaconda/storage/deviceaction.py
@@ -356,7 +356,11 @@ class ActionResizeDevice(DeviceAction):
             self.dir = RESIZE_GROW
         else:
             self.dir = RESIZE_SHRINK
-        self.origsize = device.targetSize
+        if device.targetSize > 0:
+            self.origsize = device.targetSize
+        else:
+            self.origsize = device.size
+
         self.device.targetSize = newsize
 
     def execute(self, intf=None):
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 7020309..339edec 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -230,12 +230,12 @@ def _scheduleLVs(storage, devs):
 def scheduleShrinkActions(storage):
     """ Schedule actions to shrink partitions as per autopart selection. """
     for (path, size) in storage.shrinkPartitions.items():
-        device = storage.getDeviceByPath(path)
+        device = storage.devicetree.getDeviceByPath(path)
         if not device:
             raise StorageError("device %s scheduled for shrink disappeared"
                                 % path)
-        storage.registerAction(ActionResizeFormat(device, size))
-        storage.registerAction(ActionResizeDevice(device, size))
+        storage.devicetree.registerAction(ActionResizeFormat(device, size))
+        storage.devicetree.registerAction(ActionResizeDevice(device, size))
 
 def doAutoPartition(anaconda):
     log.debug("doAutoPartition(%s)" % anaconda)
-- 
1.7.3.4

_______________________________________________
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