[blivet][PATCH] Apply default size for new partition earlier...

Brian C. Lane bcl at redhat.com
Tue Jul 14 23:45:57 UTC 2015


On Tue, Jul 14, 2015 at 01:08:56PM -0500, David Lehman wrote:
> Otherwise, if no size was passed in, the size will be Size(0) when
> the format gets set, which is problematic for formats with a minimum
> size.
> ---
>  blivet/devices/partition.py | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
> index 02acf77..4ea0e97 100644
> --- a/blivet/devices/partition.py
> +++ b/blivet/devices/partition.py
> @@ -134,6 +134,12 @@ class PartitionDevice(StorageDevice):
>          self._partedPartition = None
>          self._origPath = None
>  
> +        if not exists and size is None:
> +            if start is not None and end is not None:
> +                size = Size(0)
> +            else:
> +                size = self.defaultSize
> +
>          StorageDevice.__init__(self, name, fmt=fmt, size=size,
>                                 major=major, minor=minor, exists=exists,
>                                 sysfsPath=sysfsPath, parents=parents)
> @@ -168,13 +174,6 @@ class PartitionDevice(StorageDevice):
>              # XXX It might be worthwhile to create a shit-simple
>              #     PartitionRequest class and pass one to this constructor
>              #     for new partitions.
> -            if not self._size:
> -                if start is not None and end is not None:
> -                    self._size = Size(0)
> -                else:
> -                    # default size for new partition requests
> -                    self._size = self.defaultSize
> -
>              self.req_name = name
>              self.req_partType = partType
>              self.req_primary = primary
> -- 
> 2.4.3

Ack

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list