[anaconda-storage-branch PATCH] Resize PartitionDevice objects.

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

 



Resize PartitionDevice objects when a new targetSize is set.
---
 storage/devices.py |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 62bc804..305b087 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -933,6 +933,7 @@ class PartitionDevice(StorageDevice):
         self._targetSize = newsize
 
         if self._resize:
+            # compute new size for partition
             currentGeom = self.partedPartition.geometry
             currentDev = currentGeom.device
             newLen = long(self.targetSize * 1024 * 1024) / currentDev.sectorSize
@@ -941,11 +942,16 @@ class PartitionDevice(StorageDevice):
                                    length=newLen)
             constraint = parted.Constraint(exactGeom=geom)
 
-            partedDisk = self.disk.partedDisk
-            partedDisk.setPartitionGeometry(partition=self.partedPartition,
-                                            constraint=constraint,
-                                            start=geom.start, end=geom.end)
-            self.partedPartition = None
+            disk = self.disk.partedDisk
+            disk.setPartitionGeometry(partition=self.partedPartition,
+                                      constraint=constraint,
+                                      start=geom.start, end=geom.end)
+
+            # _origPartedDisk needs to reflect the new disk since we have
+            # resized an existing filesystem.  processActions will call
+            # resetPartedDisk, so we need to preserve the resize values in
+            # partedDisk and _origPartedDisk
+            self.disk._origPartedDisk = disk
 
     @property
     def path(self):
@@ -1135,6 +1141,8 @@ class PartitionDevice(StorageDevice):
 
         if self._resize:
             self.disk.commit()
+            self.notifyKernel()
+            self._resize = False
 
     def destroy(self):
         """ Destroy the device. """
-- 
1.6.2

_______________________________________________
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