[PATCH f21-branch/master] Update checkSizes to work in terms of Size objects (#1129629).

Anne Mulhern amulhern at redhat.com
Tue Oct 21 14:20:25 UTC 2014





----- Original Message -----
> From: "Chris Lumens" <clumens at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Tuesday, October 21, 2014 10:05:48 AM
> Subject: [PATCH f21-branch/master] Update checkSizes to work in terms of Size	objects (#1129629).
> 
> Other changes in anaconda broke the assumption in this code that we were
> working
> in terms of MB, so get rid of that assumption.
> ---
>  pyanaconda/storage_utils.py | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py
> index 7d26e78..0d41356 100644
> --- a/pyanaconda/storage_utils.py
> +++ b/pyanaconda/storage_utils.py
> @@ -165,8 +165,8 @@ def sanity_check(storage, min_ram=isys.MIN_RAM):
>  
>      exns = []
>  
> -    checkSizes = [('/usr', 250), ('/tmp', 50), ('/var', 384),
> -                  ('/home', 100), ('/boot', 200)]
> +    checkSizes = [('/usr', Size("250 MiB")), ('/tmp', Size("50 MiB")),
> ('/var', Size("384 MiB")),
> +                  ('/home', Size("100 MiB")), ('/boot', Size("200 MiB"))]
>      mustbeonlinuxfs = ['/', '/var', '/tmp', '/usr', '/home', '/usr/share',
>      '/usr/lib']
>      mustbeonroot = ['/bin','/dev','/sbin','/etc','/lib','/root', '/mnt',
>      'lost+found', '/proc']
>  
> @@ -175,7 +175,7 @@ def sanity_check(storage, min_ram=isys.MIN_RAM):
>      swaps = storage.fsset.swapDevices
>  
>      if root:
> -        if root.size < 250:
> +        if root.size < Size("250 MiB"):

Might as well make 250 a named constant instead of a literal and put
somewhere near checkSizes.

>              exns.append(
>                 SanityWarning(_("Your root partition is less than 250 "
>                                "megabytes which is usually too small to "

Also, parameterize error message above on value checked.

> @@ -207,9 +207,8 @@ def sanity_check(storage, min_ram=isys.MIN_RAM):
>          if mount in filesystems and filesystems[mount].size < size:
>              exns.append(
>                 SanityWarning(_("Your %(mount)s partition is less than "
> -                              "%(size)s megabytes which is lower than "
> -                              "recommended for a normal %(productName)s "
> -                              "install.")
> +                              "%(size)s which is lower than recommended "
> +                              "for a normal %(productName)s install.")
>                              % {'mount': mount, 'size': size,
>                                 'productName': productName}))
>  
> --
> 1.9.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

Otherwise, ack.

- mulhern

P.S. This will hit in RHEL7 in blivet, since sanityCheck() is
located there for that release.


More information about the anaconda-patches mailing list