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

Re: [NEW] Re: [PATCH] Disable partition resize support for DASD labels (#605912)



This new version looks good. You could remove the check for self.disk
since StorageDevice.resizable checks that the device exists which, in
the case of a PartitionDevice, means that self.disk is set to a
StorageDevice instance of some sort.

Dave

On Wed, 2011-01-26 at 14:07 -1000, David Cantrell wrote:
> On Wed, 26 Jan 2011, David Lehman wrote:
> 
> > On Wed, 2011-01-26 at 12:28 -1000, David Cantrell wrote:
> >> This just doesn't work and I have no idea when it will work in the
> >> future, so we should just prevent users from trying this.  Such a narrow
> >> use case.
> >
> > It would be nicer IMO to implement PartitionDevice.resizable such that
> > it does this new check and also checks super(StorageDevice,
> > self).resizable. This would remove the need to check hasattr(self,
> > "disk").
> >
> > Dave
> >
> >> ---
> >>  storage/devices.py |    3 +++
> >>  1 files changed, 3 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/storage/devices.py b/storage/devices.py
> >> index 61082be..9695470 100644
> >> --- a/storage/devices.py
> >> +++ b/storage/devices.py
> >> @@ -590,6 +590,9 @@ class StorageDevice(Device):
> >>      @property
> >>      def resizable(self):
> >>          """ Can this type of device be resized? """
> >> +        if hasattr(self, "disk") and self.disk and self.disk.type == 'dasd':
> >> +            return False
> >> +
> >>          return self._resizable and self.exists and \
> >>                 ((self.format and self.format.resizable) or not self.format)
> >>
> >
> 
> How about this revision:
> 
> 
> commit a703eb5ae5eb4a8585d69d82084748136d551c7e
> Author: David Cantrell <dcantrell redhat com>
> Date:   Wed Jan 26 11:32:12 2011 -1000
> 
>      Disable partition resize support for DASD labels (#605912)
> 
>      This just doesn't work and I have no idea when it will work in the
>      future, so we should just prevent users from trying this.  Such a narrow
>      use case.
> 
> diff --git a/storage/devices.py b/storage/devices.py
> index 61082be..82c6952 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -1503,6 +1503,11 @@ class PartitionDevice(StorageDevice):
>           else:
>               return 0
> 
> +    @property
> +    def resizable(self):
> +        """ Can this type of device be resized? """
> +        return super(PartitionDevice, self).resizable and \
> +               (self.disk and self.disk.type != 'dasd')
> 
>   class DMDevice(StorageDevice):
>       """ A device-mapper device """
> 



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