[PATCH 3/8] Fix up doResize() in class FS.

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

 



1) Raise FSResizeError exception if we enter this method, but the
   format is not resizable.  The calling methods have checks to
   prevent this from happening, so if we get this far, it should
   be an exception.

2) Take an extra parameter, the StorageDevice owning this format.

3) If the resize operation is to grow the format, grow the
   underlying StorageDevice first to support the new format size.

4) If the resize operation is to shrink the format, shrink the
   underlying StorageDevice after shrinking the format.
---
 storage/formats/fs.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/storage/formats/fs.py b/storage/formats/fs.py
index 144e8fd..0c66d38 100644
--- a/storage/formats/fs.py
+++ b/storage/formats/fs.py
@@ -315,16 +315,17 @@ class FS(DeviceFormat):
             Keyword Arguments:
 
                 intf -- InstallInterface instance
+                device -- The StorageDevice owning this format.
 
         """
         intf = kwargs.get("intf")
+        device = kwargs.get("device")
 
         if not self.exists:
             raise FSResizeError("filesystem does not exist", self.device)
 
         if not self.resizable:
-            # should this instead raise an exception?
-            return
+            raise FSResizeError("filesystem not resizable", self.device)
 
         if self.targetSize == self.currentSize:
             return
@@ -337,6 +338,12 @@ class FS(DeviceFormat):
 
         self.doCheck(intf=intf)
 
+        # grow underlying device first
+        if self.targetSize > self.currentSize:
+            if device.resizable:
+                device.size = self.targetSize
+                device.resize()
+
         w = None
         if intf:
             w = intf.progressWindow(_("Resizing"),
@@ -363,6 +370,12 @@ class FS(DeviceFormat):
         self._size = self.targetSize
         self.notifyKernel()
 
+        # resize the device holding this format
+        if self.targetSize < device.size:
+            if device.resizable:
+                device.size = self.targetSize
+                device.resize()
+
     def _getCheckArgs(self):
         argv = []
         argv.extend(self.defaultCheckOptions)
-- 
1.6.1.3

_______________________________________________
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