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

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

 



> 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.

I think this should be handled by action scheduling/sorting. We should
schedule a separate resize action for the device and for the format/fs,
and the action sorting routines should be able to figure out what order
things need to happen in.

Dave

> ---
>  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)

_______________________________________________
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