[blivet:master 20/20] Use tuples to construct Sizes() wherever units are known.

Anne Mulhern amulhern at redhat.com
Mon Jan 5 14:37:46 UTC 2015





----- Original Message -----
> From: "Vratislav Podzimek" <vpodzime at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Monday, January 5, 2015 3:08:34 AM
> Subject: Re: [blivet:master 20/20] Use tuples to construct Sizes() wherever	units are known.
> 
> I must say I don't like this change too much. Maybe we should make
> _parseSpec() faster for these "simple" cases? E.g. something like using
> s.endswith("KiB"), "MiB", "GiB",... or simple regexes first to check if
> it is a simple case we can just recognize right away?
> 
> --
> Vratislav Podzimek
> 
> Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

I'm withdrawing this patch and the preceding one.

The ultimate goal of this patch is to make use of named constants for
Size() operations, rather than strings. Strings are cumbersome, expensive,
and impossible for pylint to say anything useful about when they
are used to represent units.

I strongly suspect that in the majority of cases, the units that are required for a Size
are known at compile time, and that there is only a small set of cases where
the units are derived from user input. For those cases, it would be more
sensible to parse the user input using, e.g., _parseSpec(), passing the
result to the Size constructor. In fact, it would really be better if
anaconda handled the parsing according to its beliefs, and then simply
constructed the Size() object that the user apparently wanted. blivet should
not really be in the business of parsing user input.

This patch was a partial step toward that goal because I was trying to make it less invasive, but
I think a more invasive patch set would be actually better in the long run.

- mulhern


More information about the anaconda-patches mailing list